diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-03-02 21:10:30 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-03-04 21:24:35 +0100 |
| commit | 85c3d102bb1e03838e0fcccb820b47d1896b2455 (patch) | |
| tree | 043af47dc88a325122d5c7721a281ba3b23de36d | |
| parent | a66bf524c298ff177c3d3046ff8f2d02a81e4bc9 (diff) | |
| download | rust-85c3d102bb1e03838e0fcccb820b47d1896b2455.tar.gz rust-85c3d102bb1e03838e0fcccb820b47d1896b2455.zip | |
Add tests for #[doc(test(...)] check
| -rw-r--r-- | src/test/rustdoc-ui/doc-attr2.rs | 11 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/doc-attr2.stderr | 26 | ||||
| -rw-r--r-- | src/test/ui/attributes/doc-attr2.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/attributes/doc-attr2.stderr | 26 |
4 files changed, 74 insertions, 0 deletions
diff --git a/src/test/rustdoc-ui/doc-attr2.rs b/src/test/rustdoc-ui/doc-attr2.rs new file mode 100644 index 00000000000..3fb484644d7 --- /dev/null +++ b/src/test/rustdoc-ui/doc-attr2.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] +#![deny(warnings)] + +#[doc(test(no_crate_inject))] //~ ERROR +//~^ WARN +pub fn foo() {} + +pub mod bar { + #![doc(test(no_crate_inject))] //~ ERROR + //~^ WARN +} diff --git a/src/test/rustdoc-ui/doc-attr2.stderr b/src/test/rustdoc-ui/doc-attr2.stderr new file mode 100644 index 00000000000..7bfc37817af --- /dev/null +++ b/src/test/rustdoc-ui/doc-attr2.stderr @@ -0,0 +1,26 @@ +error: `#![doc(test(...)]` is only allowed as a crate level attribute + --> $DIR/doc-attr2.rs:4:7 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/doc-attr2.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(invalid_doc_attribute)]` implied by `#[deny(warnings)]` + = 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(...)]` is only allowed as a crate level attribute + --> $DIR/doc-attr2.rs:9:12 + | +LL | #![doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = 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 2 previous errors + diff --git a/src/test/ui/attributes/doc-attr2.rs b/src/test/ui/attributes/doc-attr2.rs new file mode 100644 index 00000000000..3fb484644d7 --- /dev/null +++ b/src/test/ui/attributes/doc-attr2.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] +#![deny(warnings)] + +#[doc(test(no_crate_inject))] //~ ERROR +//~^ WARN +pub fn foo() {} + +pub mod bar { + #![doc(test(no_crate_inject))] //~ ERROR + //~^ WARN +} diff --git a/src/test/ui/attributes/doc-attr2.stderr b/src/test/ui/attributes/doc-attr2.stderr new file mode 100644 index 00000000000..7bfc37817af --- /dev/null +++ b/src/test/ui/attributes/doc-attr2.stderr @@ -0,0 +1,26 @@ +error: `#![doc(test(...)]` is only allowed as a crate level attribute + --> $DIR/doc-attr2.rs:4:7 + | +LL | #[doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/doc-attr2.rs:2:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(invalid_doc_attribute)]` implied by `#[deny(warnings)]` + = 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(...)]` is only allowed as a crate level attribute + --> $DIR/doc-attr2.rs:9:12 + | +LL | #![doc(test(no_crate_inject))] + | ^^^^^^^^^^^^^^^^^^^^^ + | + = 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 2 previous errors + |
