Skip to content

Commit 7953d5d

Browse files
Add regression test for cfg merging on re-exports
1 parent 14ed92c commit 7953d5d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/rustdoc/reexport-cfg.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// This test ensures that only the re-export `cfg` will be displayed and that it won't
2+
// include `cfg`s from the previous chained items.
3+
4+
#![crate_name = "foo"]
5+
#![feature(doc_auto_cfg, doc_cfg)]
6+
7+
mod foo {
8+
#[cfg(not(feature = "foo"))]
9+
pub struct Bar;
10+
11+
#[doc(cfg(not(feature = "bar")))]
12+
pub struct Bar2;
13+
}
14+
15+
// @has 'foo/index.html'
16+
// @has - '//*[@class="item-name"]' 'BabarNon-lie'
17+
#[cfg(not(feature = "lie"))]
18+
pub use crate::foo::Bar as Babar;
19+
20+
// @has - '//*[@class="item-name"]' 'Babar2Non-cake'
21+
#[doc(cfg(not(feature = "cake")))]
22+
pub use crate::foo::Bar2 as Babar2;
23+
24+
// @has - '//*[@class="item-table"]/li' 'pub use crate::Babar as Elephant;Non-robot'
25+
#[cfg(not(feature = "robot"))]
26+
pub use crate::Babar as Elephant;
27+
28+
// @has - '//*[@class="item-table"]/li' 'pub use crate::Babar2 as Elephant2;Non-cat'
29+
#[doc(cfg(not(feature = "cat")))]
30+
pub use crate::Babar2 as Elephant2;

0 commit comments

Comments
 (0)