diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-03-04 21:48:07 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-03-04 21:48:07 +0100 |
| commit | 55cec9079deb3aec02bc8158de94284a42a0ee79 (patch) | |
| tree | 1bf54ec0d64dc9309cca85a22e36db933566013c | |
| parent | 85c3d102bb1e03838e0fcccb820b47d1896b2455 (diff) | |
| download | rust-55cec9079deb3aec02bc8158de94284a42a0ee79.tar.gz rust-55cec9079deb3aec02bc8158de94284a42a0ee79.zip | |
Also use INVALID_DOC_ATTRIBUTE for "unknown doc attribute" warnings
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 7 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/doc-attr.rs | 7 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/doc-attr.stderr | 11 | ||||
| -rw-r--r-- | src/test/ui/attributes/doc-attr.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/attributes/doc-attr.stderr | 11 |
5 files changed, 21 insertions, 22 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index c84d29428ad..a868802b4a6 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -585,7 +585,7 @@ impl CheckAttrVisitor<'tcx> { .any(|m| i_meta.has_name(*m)) { self.tcx.struct_span_lint_hir( - UNUSED_ATTRIBUTES, + INVALID_DOC_ATTRIBUTE, hir_id, i_meta.span, |lint| { @@ -593,11 +593,6 @@ impl CheckAttrVisitor<'tcx> { "unknown `doc` attribute `{}`", i_meta.name_or_empty() )) - .warn( - "this was previously accepted by the compiler but is \ - being phased out; it will become a hard error in \ - a future release!", - ) .emit(); }, ); diff --git a/src/test/rustdoc-ui/doc-attr.rs b/src/test/rustdoc-ui/doc-attr.rs index 3519b5707b3..3a584112973 100644 --- a/src/test/rustdoc-ui/doc-attr.rs +++ b/src/test/rustdoc-ui/doc-attr.rs @@ -1,11 +1,10 @@ #![crate_type = "lib"] -#![deny(unused_attributes)] -//~^ NOTE lint level is defined here +#![deny(warnings)] #![doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~| WARNING will become a hard error in a future release +//~^^ WARN #[doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~| WARNING will become a hard error in a future release +//~^^ WARN pub fn foo() {} diff --git a/src/test/rustdoc-ui/doc-attr.stderr b/src/test/rustdoc-ui/doc-attr.stderr index 9666db2b10e..251af7c1502 100644 --- a/src/test/rustdoc-ui/doc-attr.stderr +++ b/src/test/rustdoc-ui/doc-attr.stderr @@ -1,5 +1,5 @@ error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:8:7 + --> $DIR/doc-attr.rs:7:7 | LL | #[doc(as_ptr)] | ^^^^^^ @@ -7,17 +7,20 @@ LL | #[doc(as_ptr)] note: the lint level is defined here --> $DIR/doc-attr.rs:2:9 | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ +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: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:4:8 + --> $DIR/doc-attr.rs:3:8 | LL | #![doc(as_ptr)] | ^^^^^^ | = 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-attr.rs b/src/test/ui/attributes/doc-attr.rs index 3519b5707b3..3a584112973 100644 --- a/src/test/ui/attributes/doc-attr.rs +++ b/src/test/ui/attributes/doc-attr.rs @@ -1,11 +1,10 @@ #![crate_type = "lib"] -#![deny(unused_attributes)] -//~^ NOTE lint level is defined here +#![deny(warnings)] #![doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~| WARNING will become a hard error in a future release +//~^^ WARN #[doc(as_ptr)] //~^ ERROR unknown `doc` attribute -//~| WARNING will become a hard error in a future release +//~^^ WARN pub fn foo() {} diff --git a/src/test/ui/attributes/doc-attr.stderr b/src/test/ui/attributes/doc-attr.stderr index 9666db2b10e..251af7c1502 100644 --- a/src/test/ui/attributes/doc-attr.stderr +++ b/src/test/ui/attributes/doc-attr.stderr @@ -1,5 +1,5 @@ error: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:8:7 + --> $DIR/doc-attr.rs:7:7 | LL | #[doc(as_ptr)] | ^^^^^^ @@ -7,17 +7,20 @@ LL | #[doc(as_ptr)] note: the lint level is defined here --> $DIR/doc-attr.rs:2:9 | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ +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: unknown `doc` attribute `as_ptr` - --> $DIR/doc-attr.rs:4:8 + --> $DIR/doc-attr.rs:3:8 | LL | #![doc(as_ptr)] | ^^^^^^ | = 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 |
