Lint non-meta doc attributes
E.g., `#[doc(123)]`.
This commit is contained in:
parent
9613a88db5
commit
7189c05bf8
@ -605,6 +605,16 @@ impl CheckAttrVisitor<'tcx> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.tcx.struct_span_lint_hir(
|
||||
INVALID_DOC_ATTRIBUTES,
|
||||
hir_id,
|
||||
meta.span(),
|
||||
|lint| {
|
||||
lint.build(&format!("unknown `doc` attribute")).emit();
|
||||
},
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,3 +8,11 @@
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~^^ WARN
|
||||
pub fn foo() {}
|
||||
|
||||
#[doc(123)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARN
|
||||
#[doc("hello", "bar")]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| WARN
|
||||
fn bar() {}
|
||||
|
@ -13,6 +13,24 @@ LL | #![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!
|
||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||
|
||||
error: unknown `doc` attribute
|
||||
--> $DIR/doc-attr.rs:12:7
|
||||
|
|
||||
LL | #[doc(123)]
|
||||
| ^^^
|
||||
|
|
||||
= 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: unknown `doc` attribute
|
||||
--> $DIR/doc-attr.rs:15:7
|
||||
|
|
||||
LL | #[doc("hello", "bar")]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= 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: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:3:8
|
||||
|
|
||||
@ -22,5 +40,5 @@ 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!
|
||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user