Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/std/src/sync/poison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ impl<T> PoisonError<T> {
/// or [`RwLock::read`](crate::sync::RwLock::read).
///
/// This method may panic if std was built with `panic="abort"`.
#[doc(auto_cfg = false)]

@GuillaumeGomez GuillaumeGomez Jul 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think #[doc(auto_cfg(hide(panic, any())))] would match better but that works too.

View changes since the review

#[cfg(panic = "unwind")]
#[stable(feature = "sync_poison", since = "1.2.0")]
pub fn new(data: T) -> PoisonError<T> {
Expand All @@ -275,6 +276,7 @@ impl<T> PoisonError<T> {
/// or [`RwLock::read`](crate::sync::RwLock::read).
///
/// This method may panic if std was built with `panic="abort"`.
#[doc(auto_cfg = false)]
#[cfg(not(panic = "unwind"))]
#[stable(feature = "sync_poison", since = "1.2.0")]
#[track_caller]
Expand Down
24 changes: 24 additions & 0 deletions tests/rustdoc-html/doc-cfg/mutually-exclusive-cfg-item.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// An item split into mutually-exclusive `#[cfg(..)]` variants that together cover
// every configuration must not get a portability note when `auto_cfg` is disabled.
// Regression test for <https://github.com/rust-lang/rust/issues/149786>.

#![feature(doc_cfg)]
#![crate_name = "foo"]

pub struct S;

impl S {
//@ has 'foo/struct.S.html'
//@ count - '//*[@id="method.new"]/..//*[@class="stab portability"]' 0
#[doc(auto_cfg = false)]
#[cfg(panic = "unwind")]
pub fn new() -> S {
S
}

#[doc(auto_cfg = false)]
#[cfg(not(panic = "unwind"))]
pub fn new() -> S {
S
}
}
Loading