1
Fork 0

feature gate doc(primitive)

This commit is contained in:
Joshua Nelson 2021-07-10 22:06:10 -04:00
parent 2bd17c1d43
commit 03df65497e
9 changed files with 49 additions and 7 deletions

View file

@ -682,6 +682,9 @@ declare_features! (
/// Allows explicit generic arguments specification with `impl Trait` present.
(active, explicit_generic_args_with_impl_trait, "1.56.0", Some(83701), None),
/// Allows using doc(primitive) without a future-incompat warning
(active, doc_primitive, "1.56.0", Some(88070), None),
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------

View file

@ -794,9 +794,24 @@ impl CheckAttrVisitor<'tcx> {
| sym::notable_trait
| sym::passes
| sym::plugins
| sym::primitive
| sym::test => {}
sym::primitive => {
if !self.tcx.features().doc_primitive {
self.tcx.struct_span_lint_hir(
INVALID_DOC_ATTRIBUTES,
hir_id,
i_meta.span,
|lint| {
let mut diag = lint.build(
"`doc(primitive)` should never have been stable",
);
diag.emit();
},
);
}
}
_ => {
self.tcx.struct_span_lint_hir(
INVALID_DOC_ATTRIBUTES,

View file

@ -513,6 +513,7 @@ symbols! {
doc_keyword,
doc_masked,
doc_notable_trait,
doc_primitive,
doc_spotlight,
doctest,
document_private_items,