-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #87728 - GuillaumeGomez:doc-test-attr-checks, r=jyn514
Add "doc(test(...))" attribute checks Fixes #82672. r? `@camelid`
- Loading branch information
Showing
7 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// check-pass | ||
|
||
#![crate_type = "lib"] | ||
#![deny(invalid_doc_attributes)] | ||
#![doc(test(no_crate_inject))] | ||
#![doc(test(attr(deny(warnings))))] | ||
|
||
pub fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![crate_type = "lib"] | ||
#![deny(invalid_doc_attributes)] | ||
|
||
#![doc(test)] | ||
//~^ ERROR `#[doc(test(...)]` takes a list of attributes | ||
//~^^ WARN this was previously accepted by the compiler | ||
#![doc(test = "hello")] | ||
//~^ ERROR `#[doc(test(...)]` takes a list of attributes | ||
//~^^ WARN this was previously accepted by the compiler | ||
#![doc(test(a))] | ||
//~^ ERROR unknown `doc(test)` attribute `a` | ||
//~^^ WARN this was previously accepted by the compiler | ||
|
||
pub fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error: `#[doc(test(...)]` takes a list of attributes | ||
--> $DIR/doc-test-attr.rs:4:8 | ||
| | ||
LL | #![doc(test)] | ||
| ^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/doc-test-attr.rs:2:9 | ||
| | ||
LL | #![deny(invalid_doc_attributes)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: `#[doc(test(...)]` takes a list of attributes | ||
--> $DIR/doc-test-attr.rs:7:8 | ||
| | ||
LL | #![doc(test = "hello")] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: unknown `doc(test)` attribute `a` | ||
--> $DIR/doc-test-attr.rs:10:13 | ||
| | ||
LL | #![doc(test(a))] | ||
| ^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: aborting due to 3 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// check-pass | ||
|
||
#![crate_type = "lib"] | ||
#![deny(invalid_doc_attributes)] | ||
#![doc(test(no_crate_inject))] | ||
#![doc(test(attr(deny(warnings))))] | ||
#![doc(test())] | ||
|
||
pub fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![crate_type = "lib"] | ||
#![deny(invalid_doc_attributes)] | ||
|
||
#![doc(test)] | ||
//~^ ERROR `#[doc(test(...)]` takes a list of attributes | ||
//~^^ WARN this was previously accepted by the compiler | ||
#![doc(test = "hello")] | ||
//~^ ERROR `#[doc(test(...)]` takes a list of attributes | ||
//~^^ WARN this was previously accepted by the compiler | ||
#![doc(test(a))] | ||
//~^ ERROR unknown `doc(test)` attribute `a` | ||
//~^^ WARN this was previously accepted by the compiler | ||
|
||
pub fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
error: `#[doc(test(...)]` takes a list of attributes | ||
--> $DIR/doc-test-attr.rs:4:8 | ||
| | ||
LL | #![doc(test)] | ||
| ^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/doc-test-attr.rs:2:9 | ||
| | ||
LL | #![deny(invalid_doc_attributes)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: `#[doc(test(...)]` takes a list of attributes | ||
--> $DIR/doc-test-attr.rs:7:8 | ||
| | ||
LL | #![doc(test = "hello")] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: unknown `doc(test)` attribute `a` | ||
--> $DIR/doc-test-attr.rs:10:13 | ||
| | ||
LL | #![doc(test(a))] | ||
| ^ | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730> | ||
|
||
error: aborting due to 3 previous errors | ||
|