Files
rust/tests/rustdoc-html
Jacob Pratt a2dd212d5b Rollup merge of #159819 - Vastargazing:fix/poison-error-auto-cfg-note, r=GuillaumeGomez
std::sync::poison: disable auto_cfg on PoisonError::new

`PoisonError::new` is defined twice, once for `#[cfg(panic = "unwind")]` and once for its negation. While exactly one definition survives expansion in any given build, the method itself is actually present in every configuration.

Currently, rustdoc's `auto_cfg` only looks at whichever `cfg` survived expansion and tags the method accordingly, generating a misleading "Available on panic=unwind only" portability badge in the docs.

This is the same `auto_cfg` limitation previously addressed in rust-lang/rust#153964, rust-lang/rust#154311, and rust-lang/rust#156426: when an item is split into mutually-exclusive `cfg` variants that collectively cover all builds, rustdoc incorrectly marks it as conditionally available. Issue rust-lang/rust#149786 pointed out `PoisonError::new` as another case of this pattern, but it hadn't been touched yet.

This PR applies the same fix as rust-lang/rust#156426 (adding `#[doc(auto_cfg = false)]` to both variants) and adds a regression test to cover this pattern going forward.

r? @GuillaumeGomez
2026-07-26 00:21:49 -04:00
..
2026-07-13 10:54:53 +02:00
2026-06-12 19:11:22 -04:00
2026-04-01 23:05:42 +01:00
…
2026-02-24 11:41:26 -05:00
2026-07-13 10:54:53 +02:00
2026-07-13 10:54:53 +02:00
2026-06-07 11:06:19 +03:00
…
…
…
…
2026-06-07 13:58:33 -04:00
…
…
…
…
2026-07-13 10:54:53 +02:00
…
…
2026-02-10 18:00:54 +00:00
…
…