Skip to content

Commit 85c3d10

Browse files
Add tests for #[doc(test(...)] check
1 parent a66bf52 commit 85c3d10

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

src/test/rustdoc-ui/doc-attr2.rs

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

src/test/rustdoc-ui/doc-attr2.stderr

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: `#![doc(test(...)]` is only allowed as a crate level attribute
2+
--> $DIR/doc-attr2.rs:4:7
3+
|
4+
LL | #[doc(test(no_crate_inject))]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/doc-attr2.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attribute)]` 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+
16+
error: `#![doc(test(...)]` is only allowed as a crate level attribute
17+
--> $DIR/doc-attr2.rs:9:12
18+
|
19+
LL | #![doc(test(no_crate_inject))]
20+
| ^^^^^^^^^^^^^^^^^^^^^
21+
|
22+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
24+
25+
error: aborting due to 2 previous errors
26+

src/test/ui/attributes/doc-attr2.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![crate_type = "lib"]
2+
#![deny(warnings)]
3+
4+
#[doc(test(no_crate_inject))] //~ ERROR
5+
//~^ WARN
6+
pub fn foo() {}
7+
8+
pub mod bar {
9+
#![doc(test(no_crate_inject))] //~ ERROR
10+
//~^ WARN
11+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: `#![doc(test(...)]` is only allowed as a crate level attribute
2+
--> $DIR/doc-attr2.rs:4:7
3+
|
4+
LL | #[doc(test(no_crate_inject))]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/doc-attr2.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attribute)]` 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+
16+
error: `#![doc(test(...)]` is only allowed as a crate level attribute
17+
--> $DIR/doc-attr2.rs:9:12
18+
|
19+
LL | #![doc(test(no_crate_inject))]
20+
| ^^^^^^^^^^^^^^^^^^^^^
21+
|
22+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
24+
25+
error: aborting due to 2 previous errors
26+

0 commit comments

Comments
 (0)