Skip to content

Commit 6f0c247

Browse files
Add UI test for invalid doc(cfg_hide(...)) attributes
1 parent f528414 commit 6f0c247

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

Diff for: src/test/rustdoc-ui/doc_cfg_hide.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(doc_cfg_hide)]
2+
#![deny(warnings)]
3+
4+
#![doc(cfg_hide = "test")] //~ ERROR
5+
//~^ WARN
6+
#![doc(cfg_hide)] //~ ERROR
7+
//~^ WARN
8+
9+
#[doc(cfg_hide(doc))] //~ ERROR
10+
//~^ WARN
11+
pub fn foo() {}

Diff for: src/test/rustdoc-ui/doc_cfg_hide.stderr

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
error: this attribute can only be applied at the crate level
2+
--> $DIR/doc_cfg_hide.rs:9:7
3+
|
4+
LL | #[doc(cfg_hide(doc))]
5+
| ^^^^^^^^^^^^^
6+
|
7+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
9+
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
10+
note: the lint level is defined here
11+
--> $DIR/doc_cfg_hide.rs:2:9
12+
|
13+
LL | #![deny(warnings)]
14+
| ^^^^^^^^
15+
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
16+
help: to apply to the crate, use an inner attribute
17+
|
18+
LL | #![doc(cfg_hide(doc))]
19+
| ~~~~~~~~~~~~~~~~~~~~~~
20+
21+
error: `#[doc(cfg_hide(...)]` takes a list of attributes
22+
--> $DIR/doc_cfg_hide.rs:4:8
23+
|
24+
LL | #![doc(cfg_hide = "test")]
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+
30+
error: `#[doc(cfg_hide(...)]` takes a list of attributes
31+
--> $DIR/doc_cfg_hide.rs:6:8
32+
|
33+
LL | #![doc(cfg_hide)]
34+
| ^^^^^^^^
35+
|
36+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
37+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
38+
39+
error: aborting due to 3 previous errors
40+

0 commit comments

Comments
 (0)