Skip to content

Commit 1071085

Browse files
Add rustdoc-ui test for doc(auto_cfg) and doc(no_auto_cfg) attributes
1 parent 065495d commit 1071085

File tree

4 files changed

+74
-2
lines changed

4 files changed

+74
-2
lines changed

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
157157
.iter()
158158
.filter(|attr| attr.has_name(sym::doc))
159159
.flat_map(|attr| attr.meta_item_list().into_iter().flatten())
160-
.find(|attr| attr.has_name(sym::auto_cfg) || attr.has_name(sym::auto_cfg))
160+
.find(|attr| attr.has_name(sym::auto_cfg) || attr.has_name(sym::no_auto_cfg))
161161
{
162162
// If we find one of the two attributes, we update the default value of
163163
// `doc_auto_cfg_active`.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// edition: 2021
2+
#![deny(warnings)]
3+
#![doc(no_auto_cfg)]
4+
/*#![doc(no_auto_cfg(1))] //~ ERROR
5+
#![doc(no_auto_cfg = 1)] //~ ERROR
6+
#![doc(auto_cfg(1))] //~ ERROR
7+
#![doc(auto_cfg = 1)] //~ ERROR
8+
9+
#[doc(auto_cfg)] //~ ERROR
10+
//~^ WARN
11+
#[doc(no_auto_cfg)] //~ ERROR
12+
//~^ WARN
13+
pub struct Bar;*/
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
error: this attribute can only be applied at the crate level
2+
--> $DIR/doc_no_auto_cfg.rs:9:7
3+
|
4+
LL | #[doc(auto_cfg)]
5+
| ^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/doc_no_auto_cfg.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
13+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
15+
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
16+
help: to apply to the crate, use an inner attribute
17+
|
18+
LL | #![doc(auto_cfg)]
19+
| ~~~~~~~~~~~~~~~~~
20+
21+
error: this attribute can only be applied at the crate level
22+
--> $DIR/doc_no_auto_cfg.rs:11:7
23+
|
24+
LL | #[doc(no_auto_cfg)]
25+
| ^^^^^^^^^^^
26+
|
27+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
28+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
29+
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
30+
help: to apply to the crate, use an inner attribute
31+
|
32+
LL | #![doc(no_auto_cfg)]
33+
| ~~~~~~~~~~~~~~~~~~~~
34+
35+
error: `#![doc(no_auto_cfg)]` attribute doesn't expect a value
36+
--> $DIR/doc_no_auto_cfg.rs:4:8
37+
|
38+
LL | #![doc(no_auto_cfg(1))]
39+
| ^^^^^^^^^^^^^^
40+
41+
error: `#![doc(no_auto_cfg)]` attribute doesn't expect a value
42+
--> $DIR/doc_no_auto_cfg.rs:5:8
43+
|
44+
LL | #![doc(no_auto_cfg = 1)]
45+
| ^^^^^^^^^^^^^^^
46+
47+
error: `#![doc(auto_cfg)]` attribute doesn't expect a value
48+
--> $DIR/doc_no_auto_cfg.rs:6:8
49+
|
50+
LL | #![doc(auto_cfg(1))]
51+
| ^^^^^^^^^^^
52+
53+
error: `#![doc(auto_cfg)]` attribute doesn't expect a value
54+
--> $DIR/doc_no_auto_cfg.rs:7:8
55+
|
56+
LL | #![doc(auto_cfg = 1)]
57+
| ^^^^^^^^^^^^
58+
59+
error: aborting due to 6 previous errors
60+

src/test/rustdoc/inline_local/please_inline.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ pub mod a {
1414
pub mod b {
1515
// @hasraw - 'pub use foo::'
1616
// @!has please_inline/b/struct.Foo.html
17-
#[feature(inline)]
1817
pub use foo::Foo;
1918
}

0 commit comments

Comments
 (0)