Skip to content

Commit 55cec90

Browse files
Also use INVALID_DOC_ATTRIBUTE for "unknown doc attribute" warnings
1 parent 85c3d10 commit 55cec90

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

Diff for: compiler/rustc_passes/src/check_attr.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,14 @@ impl CheckAttrVisitor<'tcx> {
585585
.any(|m| i_meta.has_name(*m))
586586
{
587587
self.tcx.struct_span_lint_hir(
588-
UNUSED_ATTRIBUTES,
588+
INVALID_DOC_ATTRIBUTE,
589589
hir_id,
590590
i_meta.span,
591591
|lint| {
592592
lint.build(&format!(
593593
"unknown `doc` attribute `{}`",
594594
i_meta.name_or_empty()
595595
))
596-
.warn(
597-
"this was previously accepted by the compiler but is \
598-
being phased out; it will become a hard error in \
599-
a future release!",
600-
)
601596
.emit();
602597
},
603598
);

Diff for: src/test/rustdoc-ui/doc-attr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#![crate_type = "lib"]
2-
#![deny(unused_attributes)]
3-
//~^ NOTE lint level is defined here
2+
#![deny(warnings)]
43
#![doc(as_ptr)]
54
//~^ ERROR unknown `doc` attribute
6-
//~| WARNING will become a hard error in a future release
5+
//~^^ WARN
76

87
#[doc(as_ptr)]
98
//~^ ERROR unknown `doc` attribute
10-
//~| WARNING will become a hard error in a future release
9+
//~^^ WARN
1110
pub fn foo() {}

Diff for: src/test/rustdoc-ui/doc-attr.stderr

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
error: unknown `doc` attribute `as_ptr`
2-
--> $DIR/doc-attr.rs:8:7
2+
--> $DIR/doc-attr.rs:7:7
33
|
44
LL | #[doc(as_ptr)]
55
| ^^^^^^
66
|
77
note: the lint level is defined here
88
--> $DIR/doc-attr.rs:2:9
99
|
10-
LL | #![deny(unused_attributes)]
11-
| ^^^^^^^^^^^^^^^^^
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attribute)]` implied by `#[deny(warnings)]`
1213
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
1315

1416
error: unknown `doc` attribute `as_ptr`
15-
--> $DIR/doc-attr.rs:4:8
17+
--> $DIR/doc-attr.rs:3:8
1618
|
1719
LL | #![doc(as_ptr)]
1820
| ^^^^^^
1921
|
2022
= 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>
2124

2225
error: aborting due to 2 previous errors
2326

Diff for: src/test/ui/attributes/doc-attr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#![crate_type = "lib"]
2-
#![deny(unused_attributes)]
3-
//~^ NOTE lint level is defined here
2+
#![deny(warnings)]
43
#![doc(as_ptr)]
54
//~^ ERROR unknown `doc` attribute
6-
//~| WARNING will become a hard error in a future release
5+
//~^^ WARN
76

87
#[doc(as_ptr)]
98
//~^ ERROR unknown `doc` attribute
10-
//~| WARNING will become a hard error in a future release
9+
//~^^ WARN
1110
pub fn foo() {}

Diff for: src/test/ui/attributes/doc-attr.stderr

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
error: unknown `doc` attribute `as_ptr`
2-
--> $DIR/doc-attr.rs:8:7
2+
--> $DIR/doc-attr.rs:7:7
33
|
44
LL | #[doc(as_ptr)]
55
| ^^^^^^
66
|
77
note: the lint level is defined here
88
--> $DIR/doc-attr.rs:2:9
99
|
10-
LL | #![deny(unused_attributes)]
11-
| ^^^^^^^^^^^^^^^^^
10+
LL | #![deny(warnings)]
11+
| ^^^^^^^^
12+
= note: `#[deny(invalid_doc_attribute)]` implied by `#[deny(warnings)]`
1213
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14+
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
1315

1416
error: unknown `doc` attribute `as_ptr`
15-
--> $DIR/doc-attr.rs:4:8
17+
--> $DIR/doc-attr.rs:3:8
1618
|
1719
LL | #![doc(as_ptr)]
1820
| ^^^^^^
1921
|
2022
= 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>
2124

2225
error: aborting due to 2 previous errors
2326

0 commit comments

Comments
 (0)