1
Fork 0

Change error about unknown doc attributes to a warning

This prevents breakage across the ecosystem, since the error was just
introduced recently without first having a warning period.
This commit is contained in:
Joshua Nelson 2021-03-02 09:42:32 -05:00
parent edeee915b1
commit 4b2e4e69df
5 changed files with 54 additions and 17 deletions

View file

@ -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;
}
}