Fix incorrect rustdoc JSON representation of #[doc(test(..))] attrs.#153465
Fix incorrect rustdoc JSON representation of #[doc(test(..))] attrs.#153465rust-bors[bot] merged 1 commit intorust-lang:mainfrom
#[doc(test(..))] attrs.#153465Conversation
|
These commits modify Please ensure that if you've changed the output:
|
|
|
706e07d to
7abb750
Compare
#[doc(test(..))] attrs.
|
I wasn't sure if this deserves a version bump, since the bug is only present in some v57 versions and not others. I was leaning "no" but that opinion is loosely held. |
| ret.push(Attribute::Other(format!("#[doc(test(attr({snippet})))]"))); | ||
| } | ||
| } | ||
| toggle_attr(&mut ret, "no_crate_inject", no_crate_inject); |
There was a problem hiding this comment.
Why can't this be toggle_attr with "test(no_crate_inject)"?
There was a problem hiding this comment.
It absolutely could, and I'll switch it. Two things kept me from it initially. I didn't see any examples of a parenthesized arg to toggle_attr. I also wasn't sure if the // FIXME should apply to this test attr too, and mirroring that block's pattern seemed to rhyme with its FIXME comment better.
I'll change it though!
| // https://github.com/rust-lang/rust/pull/153465 | ||
|
|
||
| //@ count "$.index[?(@.inner.module.is_crate)].attrs[*]" 1 | ||
| //@ has "$.index[?(@.inner.module.is_crate)].attrs[*].other" '"#[doc(test(no_crate_inject))]"' |
There was a problem hiding this comment.
NIT: This can use is (for a slightly nicer error)
| // https://github.com/rust-lang/rust/pull/153465 | ||
|
|
||
| //@ count "$.index[?(@.inner.module.is_crate)].attrs[*]" 1 | ||
| //@ has "$.index[?(@.inner.module.is_crate)].attrs[*].other" '"#[doc(test(attr(deny(rust_2018_idioms))))]"' |
|
@bors delegate+ |
|
✌️ @obi1kenobi, you can now approve this pull request! If @aDotInTheVoid told you to " |
7abb750 to
d3149ca
Compare
|
@bors r=aDotInTheVoid |
|
@bors rollup=always |
…, r=aDotInTheVoid Fix incorrect rustdoc JSON representation of `#[doc(test(..))]` attrs. Attributes like `#[doc(test(attr(deny(rust_2018_idioms))))]` are accidentally emitted without the final `]`. Also, the `#[doc(test(no_crate_inject))]` attribute is mistakenly emitted as `#[doc(no_crate_inject)]` — note the missing `test` wrapper. This PR adds the missing `]` and fixes the `no_crate_inject`, and adds regression tests for both. Thanks to the folks working on `tonic` and `pyo3` for reporting a `cargo-semver-checks` crash on Rust 1.94 in their projects, which led me to finding this bug. Refs: - https://github.com/hyperium/tonic/actions/runs/22732044107/job/65957306230?pr=2536 - https://github.com/PyO3/pyo3/actions/runs/22745106403/job/65967167797 - obi1kenobi/cargo-semver-checks#1590 r? @aDotInTheVoid
Rollup merge of #153465 - obi1kenobi:pg/trailing-bracket-fix, r=aDotInTheVoid Fix incorrect rustdoc JSON representation of `#[doc(test(..))]` attrs. Attributes like `#[doc(test(attr(deny(rust_2018_idioms))))]` are accidentally emitted without the final `]`. Also, the `#[doc(test(no_crate_inject))]` attribute is mistakenly emitted as `#[doc(no_crate_inject)]` — note the missing `test` wrapper. This PR adds the missing `]` and fixes the `no_crate_inject`, and adds regression tests for both. Thanks to the folks working on `tonic` and `pyo3` for reporting a `cargo-semver-checks` crash on Rust 1.94 in their projects, which led me to finding this bug. Refs: - https://github.com/hyperium/tonic/actions/runs/22732044107/job/65957306230?pr=2536 - https://github.com/PyO3/pyo3/actions/runs/22745106403/job/65967167797 - obi1kenobi/cargo-semver-checks#1590 r? @aDotInTheVoid
Attributes like
#[doc(test(attr(deny(rust_2018_idioms))))]are accidentally emitted without the final].Also, the
#[doc(test(no_crate_inject))]attribute is mistakenly emitted as#[doc(no_crate_inject)]— note the missingtestwrapper.This PR adds the missing
]and fixes theno_crate_inject, and adds regression tests for both.Thanks to the folks working on
tonicandpyo3for reporting acargo-semver-checkscrash on Rust 1.94 in their projects, which led me to finding this bug. Refs:r? @aDotInTheVoid