Files
rust/tests/rustdoc-html/doc-cfg/extern-items.rs
T
2026-04-29 18:02:25 +02:00

27 lines
776 B
Rust

// Ensure that the `cfg` on the extern blocks are correctly taken into account by
// their children.
// Regression test for <https://github.com/rust-lang/rust/issues/150268>.
#![feature(doc_cfg)]
#![crate_name = "foo"]
//@has 'foo/index.html'
//@count - '//*[@class="stab portability"]' 2
//@has - '//*[@class="stab portability"]' 'Non-banana'
//@has 'foo/fn.doc_cfg_doesnt_work.html'
//@has - '//*[@class="stab portability"]' 'Available on non-crate feature banana only.'
//@has 'foo/fn.doc_cfg_works.html'
//@has - '//*[@class="stab portability"]' 'Available on non-crate feature banana only.'
unsafe extern "C" {
#[cfg(not(feature = "banana"))]
pub fn doc_cfg_works();
}
#[cfg(not(feature = "banana"))]
unsafe extern "C" {
pub fn doc_cfg_doesnt_work();
}