mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Fix deny(invalid_doc_attributes)
This commit is contained in:
parent
c4c2ab57a4
commit
261f64358c
@ -2994,6 +2994,7 @@ declare_lint_pass! {
|
|||||||
USELESS_DEPRECATED,
|
USELESS_DEPRECATED,
|
||||||
UNSUPPORTED_NAKED_FUNCTIONS,
|
UNSUPPORTED_NAKED_FUNCTIONS,
|
||||||
MISSING_ABI,
|
MISSING_ABI,
|
||||||
|
INVALID_DOC_ATTRIBUTES,
|
||||||
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
|
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
|
||||||
DISJOINT_CAPTURE_MIGRATION,
|
DISJOINT_CAPTURE_MIGRATION,
|
||||||
LEGACY_DERIVE_HELPERS,
|
LEGACY_DERIVE_HELPERS,
|
||||||
|
@ -217,8 +217,9 @@ crate fn create_config(
|
|||||||
// By default, rustdoc ignores all lints.
|
// By default, rustdoc ignores all lints.
|
||||||
// Specifically unblock lints relevant to documentation or the lint machinery itself.
|
// Specifically unblock lints relevant to documentation or the lint machinery itself.
|
||||||
let mut lints_to_show = vec![
|
let mut lints_to_show = vec![
|
||||||
// it's unclear whether this should be part of rustdoc directly (#77364)
|
// it's unclear whether these should be part of rustdoc directly (#77364)
|
||||||
rustc_lint::builtin::MISSING_DOCS.name.to_string(),
|
rustc_lint::builtin::MISSING_DOCS.name.to_string(),
|
||||||
|
rustc_lint::builtin::INVALID_DOC_ATTRIBUTES.name.to_string(),
|
||||||
// these are definitely not part of rustdoc, but we want to warn on them anyway.
|
// these are definitely not part of rustdoc, but we want to warn on them anyway.
|
||||||
rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_string(),
|
rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_string(),
|
||||||
rustc_lint::builtin::UNKNOWN_LINTS.name.to_string(),
|
rustc_lint::builtin::UNKNOWN_LINTS.name.to_string(),
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// check-pass
|
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
#![deny(warnings)]
|
||||||
#![feature(doc_notable_trait)]
|
#![feature(doc_notable_trait)]
|
||||||
|
|
||||||
#[doc(notable_trait)]
|
#[doc(notable_trait)]
|
||||||
//~^ WARN unknown `doc` attribute `spotlight`
|
//~^ ERROR unknown `doc` attribute `spotlight`
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
trait MyTrait {}
|
trait MyTrait {}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
// check-pass
|
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
#![deny(warnings)]
|
||||||
#![feature(doc_notable_trait)]
|
#![feature(doc_notable_trait)]
|
||||||
|
|
||||||
#[doc(spotlight)]
|
#[doc(spotlight)]
|
||||||
//~^ WARN unknown `doc` attribute `spotlight`
|
//~^ ERROR unknown `doc` attribute `spotlight`
|
||||||
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
trait MyTrait {}
|
trait MyTrait {}
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
warning: unknown `doc` attribute `spotlight`
|
error: unknown `doc` attribute `spotlight`
|
||||||
--> $DIR/doc-spotlight.rs:6:7
|
--> $DIR/doc-spotlight.rs:5:7
|
||||||
|
|
|
|
||||||
LL | #[doc(spotlight)]
|
LL | #[doc(spotlight)]
|
||||||
| ^^^^^^^^^ help: use `notable_trait` instead
|
| ^^^^^^^^^ help: use `notable_trait` instead
|
||||||
|
|
|
|
||||||
= note: `#[warn(invalid_doc_attributes)]` on by default
|
note: the lint level is defined here
|
||||||
|
--> $DIR/doc-spotlight.rs:2:9
|
||||||
|
|
|
||||||
|
LL | #![deny(warnings)]
|
||||||
|
| ^^^^^^^^
|
||||||
|
= note: `#[deny(invalid_doc_attributes)]` 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!
|
= 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>
|
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||||
= note: `doc(spotlight)` was renamed to `doc(notable_trait)`
|
= note: `doc(spotlight)` was renamed to `doc(notable_trait)`
|
||||||
= note: `doc(spotlight)` is now a no-op
|
= note: `doc(spotlight)` is now a no-op
|
||||||
|
|
||||||
warning: 1 warning emitted
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
7
src/test/ui/rustdoc/deny-invalid-doc-attrs.rs
Normal file
7
src/test/ui/rustdoc/deny-invalid-doc-attrs.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#![deny(invalid_doc_attributes)]
|
||||||
|
//~^ NOTE defined here
|
||||||
|
#![doc(x)]
|
||||||
|
//~^ ERROR unknown `doc` attribute `x`
|
||||||
|
//~| WARNING will become a hard error
|
||||||
|
//~| NOTE see issue #82730
|
||||||
|
fn main() {}
|
16
src/test/ui/rustdoc/deny-invalid-doc-attrs.stderr
Normal file
16
src/test/ui/rustdoc/deny-invalid-doc-attrs.stderr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
error: unknown `doc` attribute `x`
|
||||||
|
--> $DIR/deny-invalid-doc-attrs.rs:3:8
|
||||||
|
|
|
||||||
|
LL | #![doc(x)]
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
note: the lint level is defined here
|
||||||
|
--> $DIR/deny-invalid-doc-attrs.rs:1: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: aborting due to previous error
|
||||||
|
|
Loading…
Reference in New Issue
Block a user