Skip to content

Commit 2dd7184

Browse files
authored
Rollup merge of rust-lang#85501 - jyn514:invalid-doc-attrs, r=varkor
Fix `deny(invalid_doc_attributes)` Fixes rust-lang#85497.
2 parents 573ef2c + 261f643 commit 2dd7184

File tree

7 files changed

+39
-11
lines changed

7 files changed

+39
-11
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2994,6 +2994,7 @@ declare_lint_pass! {
29942994
USELESS_DEPRECATED,
29952995
UNSUPPORTED_NAKED_FUNCTIONS,
29962996
MISSING_ABI,
2997+
INVALID_DOC_ATTRIBUTES,
29972998
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
29982999
DISJOINT_CAPTURE_MIGRATION,
29993000
LEGACY_DERIVE_HELPERS,

src/librustdoc/core.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ crate fn create_config(
217217
// By default, rustdoc ignores all lints.
218218
// Specifically unblock lints relevant to documentation or the lint machinery itself.
219219
let mut lints_to_show = vec![
220-
// it's unclear whether this should be part of rustdoc directly (#77364)
220+
// it's unclear whether these should be part of rustdoc directly (#77364)
221221
rustc_lint::builtin::MISSING_DOCS.name.to_string(),
222+
rustc_lint::builtin::INVALID_DOC_ATTRIBUTES.name.to_string(),
222223
// these are definitely not part of rustdoc, but we want to warn on them anyway.
223224
rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_string(),
224225
rustc_lint::builtin::UNKNOWN_LINTS.name.to_string(),
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// check-pass
21
// run-rustfix
3-
2+
#![deny(warnings)]
43
#![feature(doc_notable_trait)]
54

65
#[doc(notable_trait)]
7-
//~^ WARN unknown `doc` attribute `spotlight`
6+
//~^ ERROR unknown `doc` attribute `spotlight`
87
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
98
trait MyTrait {}

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// check-pass
21
// run-rustfix
3-
2+
#![deny(warnings)]
43
#![feature(doc_notable_trait)]
54

65
#[doc(spotlight)]
7-
//~^ WARN unknown `doc` attribute `spotlight`
6+
//~^ ERROR unknown `doc` attribute `spotlight`
87
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
98
trait MyTrait {}
+9-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
warning: unknown `doc` attribute `spotlight`
2-
--> $DIR/doc-spotlight.rs:6:7
1+
error: unknown `doc` attribute `spotlight`
2+
--> $DIR/doc-spotlight.rs:5:7
33
|
44
LL | #[doc(spotlight)]
55
| ^^^^^^^^^ help: use `notable_trait` instead
66
|
7-
= note: `#[warn(invalid_doc_attributes)]` on by default
7+
note: the lint level is defined here
8+
--> $DIR/doc-spotlight.rs:2:9
9+
|
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
813
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
914
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
1015
= note: `doc(spotlight)` was renamed to `doc(notable_trait)`
1116
= note: `doc(spotlight)` is now a no-op
1217

13-
warning: 1 warning emitted
18+
error: aborting due to previous error
1419

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![deny(invalid_doc_attributes)]
2+
//~^ NOTE defined here
3+
#![doc(x)]
4+
//~^ ERROR unknown `doc` attribute `x`
5+
//~| WARNING will become a hard error
6+
//~| NOTE see issue #82730
7+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: unknown `doc` attribute `x`
2+
--> $DIR/deny-invalid-doc-attrs.rs:3:8
3+
|
4+
LL | #![doc(x)]
5+
| ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/deny-invalid-doc-attrs.rs:1:9
9+
|
10+
LL | #![deny(invalid_doc_attributes)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
14+
15+
error: aborting due to previous error
16+

0 commit comments

Comments
 (0)