File tree Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,11 @@ pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[
9595 ConditionalPass :: always ( CHECK_DOC_TEST_VISIBILITY ) ,
9696 ConditionalPass :: always ( CHECK_DOC_CFG ) ,
9797 ConditionalPass :: always ( STRIP_ALIASED_NON_LOCAL ) ,
98+ ConditionalPass :: always ( PROPAGATE_DOC_CFG ) ,
9899 ConditionalPass :: new ( STRIP_HIDDEN , WhenNotDocumentHidden ) ,
99100 ConditionalPass :: new ( STRIP_PRIVATE , WhenNotDocumentPrivate ) ,
100101 ConditionalPass :: new ( STRIP_PRIV_IMPORTS , WhenDocumentPrivate ) ,
101102 ConditionalPass :: always ( COLLECT_INTRA_DOC_LINKS ) ,
102- ConditionalPass :: always ( PROPAGATE_DOC_CFG ) ,
103103 ConditionalPass :: always ( PROPAGATE_STABILITY ) ,
104104 ConditionalPass :: always ( RUN_LINTS ) ,
105105] ;
Original file line number Diff line number Diff line change 22#[ doc( cfg = "x" ) ] //~ ERROR not followed by parentheses
33#[ doc( cfg( x, y) ) ] //~ ERROR multiple `cfg` predicates
44pub struct S { }
5+
6+ // We check it also fails on private items.
7+ #[ doc( cfg = "x" ) ] //~ ERROR not followed by parentheses
8+ #[ doc( cfg( x, y) ) ] //~ ERROR multiple `cfg` predicates
9+ struct X { }
10+
11+ // We check it also fails on hidden items.
12+ #[ doc( cfg = "x" ) ] //~ ERROR not followed by parentheses
13+ #[ doc( cfg( x, y) ) ] //~ ERROR multiple `cfg` predicates
14+ #[ doc( hidden) ]
15+ pub struct Y { }
16+
17+ // We check it also fails on hidden AND private items.
18+ #[ doc( cfg = "x" ) ] //~ ERROR not followed by parentheses
19+ #[ doc( cfg( x, y) ) ] //~ ERROR multiple `cfg` predicates
20+ #[ doc( hidden) ]
21+ struct Z { }
Original file line number Diff line number Diff line change @@ -10,5 +10,41 @@ error: multiple `cfg` predicates are specified
1010LL | #[doc(cfg(x, y))]
1111 | ^
1212
13- error: aborting due to 2 previous errors
13+ error: `cfg` is not followed by parentheses
14+ --> $DIR/invalid-cfg.rs:7:7
15+ |
16+ LL | #[doc(cfg = "x")]
17+ | ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
18+
19+ error: multiple `cfg` predicates are specified
20+ --> $DIR/invalid-cfg.rs:8:14
21+ |
22+ LL | #[doc(cfg(x, y))]
23+ | ^
24+
25+ error: `cfg` is not followed by parentheses
26+ --> $DIR/invalid-cfg.rs:12:7
27+ |
28+ LL | #[doc(cfg = "x")]
29+ | ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
30+
31+ error: multiple `cfg` predicates are specified
32+ --> $DIR/invalid-cfg.rs:13:14
33+ |
34+ LL | #[doc(cfg(x, y))]
35+ | ^
36+
37+ error: `cfg` is not followed by parentheses
38+ --> $DIR/invalid-cfg.rs:18:7
39+ |
40+ LL | #[doc(cfg = "x")]
41+ | ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
42+
43+ error: multiple `cfg` predicates are specified
44+ --> $DIR/invalid-cfg.rs:19:14
45+ |
46+ LL | #[doc(cfg(x, y))]
47+ | ^
48+
49+ error: aborting due to 8 previous errors
1450
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ Default passes for rustdoc:
1717check_doc_test_visibility
1818 check-doc-cfg
1919strip-aliased-non-local
20+ propagate-doc-cfg
2021 strip-hidden (when not --document-hidden-items)
2122 strip-private (when not --document-private-items)
2223 strip-priv-imports (when --document-private-items)
2324collect-intra-doc-links
24- propagate-doc-cfg
2525 propagate-stability
2626 run-lints
2727
You can’t perform that action at this time.
0 commit comments