Auto merge of #82702 - jyn514:downgrade-err, r=Manishearth
Change error about unknown attributes to a warning Hard errors should go through a future-compatibility phase first, especially since these attributes only have no effect and don't actively cause bugs. Follow-up to https://github.com/rust-lang/rust/pull/82662. Fixes ecosystem breakage like https://github.com/rust-lang/rust-clippy/issues/6832. r? `@GuillaumeGomez`
This commit is contained in:
commit
1c77a1fa3c
@ -567,16 +567,23 @@ impl CheckAttrVisitor<'tcx> {
|
||||
.iter()
|
||||
.any(|m| i_meta.has_name(*m))
|
||||
{
|
||||
self.tcx
|
||||
.sess
|
||||
.struct_span_err(
|
||||
meta.span(),
|
||||
&format!(
|
||||
self.tcx.struct_span_lint_hir(
|
||||
UNUSED_ATTRIBUTES,
|
||||
hir_id,
|
||||
i_meta.span,
|
||||
|lint| {
|
||||
lint.build(&format!(
|
||||
"unknown `doc` attribute `{}`",
|
||||
i_meta.name_or_empty(),
|
||||
),
|
||||
)
|
||||
.emit();
|
||||
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();
|
||||
},
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
#![crate_type = "lib"]
|
||||
#![doc(as_ptr)] //~ ERROR
|
||||
#![deny(unused_attributes)]
|
||||
//~^ NOTE lint level is defined here
|
||||
#![doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARNING will become a hard error in a future release
|
||||
|
||||
#[doc(as_ptr)] //~ ERROR
|
||||
#[doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARNING will become a hard error in a future release
|
||||
pub fn foo() {}
|
||||
|
@ -1,14 +1,23 @@
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:4:7
|
||||
--> $DIR/doc-attr.rs:8:7
|
||||
|
|
||||
LL | #[doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/doc-attr.rs:2:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:2:8
|
||||
--> $DIR/doc-attr.rs:4: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!
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
#![crate_type = "lib"]
|
||||
#![doc(as_ptr)] //~ ERROR
|
||||
#![deny(unused_attributes)]
|
||||
//~^ NOTE lint level is defined here
|
||||
#![doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARNING will become a hard error in a future release
|
||||
|
||||
#[doc(as_ptr)] //~ ERROR
|
||||
#[doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARNING will become a hard error in a future release
|
||||
pub fn foo() {}
|
||||
|
@ -1,14 +1,23 @@
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:4:7
|
||||
--> $DIR/doc-attr.rs:8:7
|
||||
|
|
||||
LL | #[doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/doc-attr.rs:2:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:2:8
|
||||
--> $DIR/doc-attr.rs:4: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!
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user