Skip to content

Commit 713578b

Browse files
committed
Exclude cfg "doc" and "doctest" from feature doc_auto_cfg
1 parent 9aa1ccd commit 713578b

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/librustdoc/visit_ast.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
141141
})
142142
.collect::<Vec<_>>()
143143
})
144-
.chain([Cfg::Cfg(sym::test, None)].into_iter())
144+
.chain(
145+
[Cfg::Cfg(sym::test, None), Cfg::Cfg(sym::doc, None), Cfg::Cfg(sym::doctest, None)]
146+
.into_iter(),
147+
)
145148
.collect();
146149

147150
self.cx.cache.exact_paths = self.exact_paths;

src/test/rustdoc/doc-auto-cfg.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,34 @@
22
#![crate_name = "foo"]
33

44
// @has foo/fn.foo.html
5-
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-doctest'
6-
#[cfg(not(doctest))]
5+
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-meowmeow'
6+
#[cfg(not(meowmeow))]
77
pub fn foo() {}
88

99
// @has foo/fn.bar.html
10-
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
10+
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'meowmeow'
1111
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'test'
12-
#[cfg(any(test, doc))]
12+
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
13+
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doctest'
14+
#[cfg(any(meowmeow, test, doc, doctest))]
1315
pub fn bar() {}
1416

1517
// @has foo/fn.appear_1.html
16-
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
18+
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'meowmeow'
19+
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
1720
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'non-test'
18-
#[cfg(any(doc, not(test)))]
21+
#[cfg(any(meowmeow, doc, not(test)))]
1922
pub fn appear_1() {} // issue #98065
2023

2124
// @has foo/fn.appear_2.html
22-
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
25+
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'meowmeow'
26+
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
2327
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'test'
24-
#[cfg(any(doc, all(test)))]
28+
#[cfg(any(meowmeow, doc, all(test)))]
2529
pub fn appear_2() {} // issue #98065
2630

2731
// @has foo/fn.appear_3.html
28-
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
29-
#[cfg(any(doc, all()))]
32+
// @has - '//*[@class="item-info"]/*[@class="stab portability"]' 'meowmeow'
33+
// @!has - '//*[@class="item-info"]/*[@class="stab portability"]' 'doc'
34+
#[cfg(any(meowmeow, doc, all()))]
3035
pub fn appear_3() {} // issue #98065

0 commit comments

Comments
 (0)