Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit df7915c

Browse files
authoredMar 2, 2024
Unrolled build for rust-lang#111505
Rollup merge of rust-lang#111505 - GuillaumeGomez:turn-invalid-doc-attr-into-err, r=rustdoc Made `INVALID_DOC_ATTRIBUTES` lint deny by default Fixes rust-lang#82730. # Explanations The `INVALID_DOC_ATTRIBUTES` lint was marked as "will become a hard error into the future" for quite some time so making it `deny` by default. <del>Waiting on rust-lang/backtrace-rs#524 for now.</del>
2 parents e612d07 + 8e817af commit df7915c

28 files changed

+56
-251
lines changed
 

‎compiler/rustc_lint_defs/src/builtin.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -3586,18 +3586,9 @@ declare_lint! {
35863586
/// being validated. Usually these should be rejected as a hard error,
35873587
/// but this lint was introduced to avoid breaking any existing
35883588
/// crates which included them.
3589-
///
3590-
/// This is a [future-incompatible] lint to transition this to a hard
3591-
/// error in the future. See [issue #82730] for more details.
3592-
///
3593-
/// [issue #82730]: https://github.com/rust-lang/rust/issues/82730
35943589
pub INVALID_DOC_ATTRIBUTES,
3595-
Warn,
3590+
Deny,
35963591
"detects invalid `#[doc(...)]` attributes",
3597-
@future_incompatible = FutureIncompatibleInfo {
3598-
reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps,
3599-
reference: "issue #82730 <https://github.com/rust-lang/rust/issues/82730>",
3600-
};
36013592
}
36023593

36033594
declare_lint! {
+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
//@ check-pass
2-
31
#[doc(include = "external-cross-doc.md")]
4-
//~^ WARNING unknown `doc` attribute `include`
2+
//~^ ERROR unknown `doc` attribute `include`
53
//~| HELP use `doc = include_str!` instead
64
// FIXME(#85497): make this a deny instead so it's more clear what's happening
75
//~| NOTE on by default
8-
//~| WARNING previously accepted
9-
//~| NOTE see issue #82730
106
pub struct NeedMoreDocs;
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
warning: unknown `doc` attribute `include`
2-
--> $DIR/doc-include-suggestion.rs:3:7
1+
error: unknown `doc` attribute `include`
2+
--> $DIR/doc-include-suggestion.rs:1:7
33
|
44
LL | #[doc(include = "external-cross-doc.md")]
55
| ------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- help: use `doc = include_str!` instead: `#[doc = include_str!("external-cross-doc.md")]`
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
9-
= note: `#[warn(invalid_doc_attributes)]` on by default
7+
= note: `#[deny(invalid_doc_attributes)]` on by default
108

11-
warning: 1 warning emitted
9+
error: aborting due to 1 previous error
1210

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
#![crate_type = "lib"]
2-
#![deny(invalid_doc_attributes)]
32

43
#![doc(test)]
54
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
6-
//~^^ WARN this was previously accepted by the compiler
75
#![doc(test = "hello")]
86
//~^ ERROR `#[doc(test(...)]` takes a list of attributes
9-
//~^^ WARN this was previously accepted by the compiler
107
#![doc(test(a))]
118
//~^ ERROR unknown `doc(test)` attribute `a`
12-
//~^^ WARN this was previously accepted by the compiler
139

1410
pub fn foo() {}
+4-16
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
error: `#[doc(test(...)]` takes a list of attributes
2-
--> $DIR/doc-test-attr.rs:4:8
2+
--> $DIR/doc-test-attr.rs:3:8
33
|
44
LL | #![doc(test)]
55
| ^^^^
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
9-
note: the lint level is defined here
10-
--> $DIR/doc-test-attr.rs:2:9
11-
|
12-
LL | #![deny(invalid_doc_attributes)]
13-
| ^^^^^^^^^^^^^^^^^^^^^^
7+
= note: `#[deny(invalid_doc_attributes)]` on by default
148

159
error: `#[doc(test(...)]` takes a list of attributes
16-
--> $DIR/doc-test-attr.rs:7:8
10+
--> $DIR/doc-test-attr.rs:5:8
1711
|
1812
LL | #![doc(test = "hello")]
1913
| ^^^^^^^^^^^^^^
20-
|
21-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
22-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
2314

2415
error: unknown `doc(test)` attribute `a`
25-
--> $DIR/doc-test-attr.rs:10:13
16+
--> $DIR/doc-test-attr.rs:7:13
2617
|
2718
LL | #![doc(test(a))]
2819
| ^
29-
|
30-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
31-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
3220

3321
error: aborting due to 3 previous errors
3422

‎tests/rustdoc-ui/lints/doc-attr.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
#![crate_type = "lib"]
2-
#![deny(warnings)]
32
#![doc(as_ptr)]
43
//~^ ERROR unknown `doc` attribute
5-
//~^^ WARN
64

75
#[doc(as_ptr)]
86
//~^ ERROR unknown `doc` attribute
9-
//~^^ WARN
107
pub fn foo() {}
118

129
#[doc(123)]
1310
//~^ ERROR invalid `doc` attribute
14-
//~| WARN
1511
#[doc("hello", "bar")]
1612
//~^ ERROR invalid `doc` attribute
17-
//~| WARN
1813
//~| ERROR invalid `doc` attribute
19-
//~| WARN
2014
#[doc(foo::bar, crate::bar::baz = "bye")]
2115
//~^ ERROR unknown `doc` attribute
22-
//~| WARN
2316
//~| ERROR unknown `doc` attribute
24-
//~| WARN
2517
fn bar() {}
+8-33
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,46 @@
11
error: unknown `doc` attribute `as_ptr`
2-
--> $DIR/doc-attr.rs:7:7
2+
--> $DIR/doc-attr.rs:5:7
33
|
44
LL | #[doc(as_ptr)]
55
| ^^^^^^
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
9-
note: the lint level is defined here
10-
--> $DIR/doc-attr.rs:2:9
11-
|
12-
LL | #![deny(warnings)]
13-
| ^^^^^^^^
14-
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
7+
= note: `#[deny(invalid_doc_attributes)]` on by default
158

169
error: invalid `doc` attribute
17-
--> $DIR/doc-attr.rs:12:7
10+
--> $DIR/doc-attr.rs:9:7
1811
|
1912
LL | #[doc(123)]
2013
| ^^^
21-
|
22-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
2414

2515
error: invalid `doc` attribute
26-
--> $DIR/doc-attr.rs:15:7
16+
--> $DIR/doc-attr.rs:11:7
2717
|
2818
LL | #[doc("hello", "bar")]
2919
| ^^^^^^^
30-
|
31-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
32-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
3320

3421
error: invalid `doc` attribute
35-
--> $DIR/doc-attr.rs:15:16
22+
--> $DIR/doc-attr.rs:11:16
3623
|
3724
LL | #[doc("hello", "bar")]
3825
| ^^^^^
39-
|
40-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
41-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
4226

4327
error: unknown `doc` attribute `foo::bar`
44-
--> $DIR/doc-attr.rs:20:7
28+
--> $DIR/doc-attr.rs:14:7
4529
|
4630
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
4731
| ^^^^^^^^
48-
|
49-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
50-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
5132

5233
error: unknown `doc` attribute `crate::bar::baz`
53-
--> $DIR/doc-attr.rs:20:17
34+
--> $DIR/doc-attr.rs:14:17
5435
|
5536
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
5637
| ^^^^^^^^^^^^^^^^^^^^^^^
57-
|
58-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
59-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
6038

6139
error: unknown `doc` attribute `as_ptr`
62-
--> $DIR/doc-attr.rs:3:8
40+
--> $DIR/doc-attr.rs:2:8
6341
|
6442
LL | #![doc(as_ptr)]
6543
| ^^^^^^
66-
|
67-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
68-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
6944

7045
error: aborting due to 7 previous errors
7146

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ run-rustfix
2-
#![deny(warnings)]
32
#![feature(doc_notable_trait)]
43

54
#[doc(notable_trait)]
65
//~^ ERROR unknown `doc` attribute `spotlight`
7-
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
86
trait MyTrait {}
-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ run-rustfix
2-
#![deny(warnings)]
32
#![feature(doc_notable_trait)]
43

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

1811
error: aborting due to 1 previous error
1912

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#![feature(doc_cfg_hide)]
2-
#![deny(warnings)]
32

43
#![doc(cfg_hide = "test")] //~ ERROR
5-
//~^ WARN
64
#![doc(cfg_hide)] //~ ERROR
7-
//~^ WARN
85

96
#[doc(cfg_hide(doc))] //~ ERROR
10-
//~^ WARN
117
pub fn foo() {}
+4-17
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
11
error: this attribute can only be applied at the crate level
2-
--> $DIR/doc_cfg_hide.rs:9:7
2+
--> $DIR/doc_cfg_hide.rs:6:7
33
|
44
LL | #[doc(cfg_hide(doc))]
55
| ^^^^^^^^^^^^^
66
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
97
= note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
10-
note: the lint level is defined here
11-
--> $DIR/doc_cfg_hide.rs:2:9
12-
|
13-
LL | #![deny(warnings)]
14-
| ^^^^^^^^
15-
= note: `#[deny(invalid_doc_attributes)]` implied by `#[deny(warnings)]`
8+
= note: `#[deny(invalid_doc_attributes)]` on by default
169
help: to apply to the crate, use an inner attribute
1710
|
1811
LL | #![doc(cfg_hide(doc))]
1912
| +
2013

2114
error: `#[doc(cfg_hide(...))]` takes a list of attributes
22-
--> $DIR/doc_cfg_hide.rs:4:8
15+
--> $DIR/doc_cfg_hide.rs:3:8
2316
|
2417
LL | #![doc(cfg_hide = "test")]
2518
| ^^^^^^^^^^^^^^^^^
26-
|
27-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
28-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
2919

3020
error: `#[doc(cfg_hide(...))]` takes a list of attributes
31-
--> $DIR/doc_cfg_hide.rs:6:8
21+
--> $DIR/doc_cfg_hide.rs:4:8
3222
|
3323
LL | #![doc(cfg_hide)]
3424
| ^^^^^^^^
35-
|
36-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
37-
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
3825

3926
error: aborting due to 3 previous errors
4027

Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
#![crate_type = "lib"]
2-
#![deny(warnings)]
32
#![feature(doc_masked)]
43

54
#![doc(masked)]
65
//~^ ERROR this attribute can only be applied to an `extern crate` item
7-
//~| WARN is being phased out
86

97
#[doc(test(no_crate_inject))]
108
//~^ ERROR can only be applied at the crate level
11-
//~| WARN is being phased out
129
//~| HELP to apply to the crate, use an inner attribute
1310
//~| SUGGESTION !
1411
#[doc(inline)]
1512
//~^ ERROR can only be applied to a `use` item
16-
//~| WARN is being phased out
1713
pub fn foo() {}
1814

1915
pub mod bar {
2016
#![doc(test(no_crate_inject))]
2117
//~^ ERROR can only be applied at the crate level
22-
//~| WARN is being phased out
2318

2419
#[doc(test(no_crate_inject))]
2520
//~^ ERROR can only be applied at the crate level
26-
//~| WARN is being phased out
2721
#[doc(inline)]
2822
//~^ ERROR can only be applied to a `use` item
29-
//~| WARN is being phased out
3023
pub fn baz() {}
3124
}
3225

@@ -38,10 +31,8 @@ pub use bar::baz;
3831

3932
#[doc(masked)]
4033
//~^ ERROR this attribute can only be applied to an `extern crate` item
41-
//~| WARN is being phased out
4234
pub struct Masked;
4335

4436
#[doc(masked)]
4537
//~^ ERROR this attribute cannot be applied to an `extern crate self` item
46-
//~| WARN is being phased out
4738
pub extern crate self as reexport;
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.