Lint non-meta doc attributes
E.g., `#[doc(123)]`.
This commit is contained in:
parent
9613a88db5
commit
7189c05bf8
3 changed files with 37 additions and 1 deletions
|
@ -605,6 +605,16 @@ impl CheckAttrVisitor<'tcx> {
|
||||||
return false;
|
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
|
//~^ ERROR unknown `doc` attribute
|
||||||
//~^^ WARN
|
//~^^ WARN
|
||||||
pub fn foo() {}
|
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!
|
= 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>
|
= 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`
|
error: unknown `doc` attribute `as_ptr`
|
||||||
--> $DIR/doc-attr.rs:3:8
|
--> $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!
|
= 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>
|
= 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…
Add table
Add a link
Reference in a new issue