1
Fork 0

Error on #[rustc_deprecated]

This commit is contained in:
Jacob Pratt 2022-04-07 23:44:55 -04:00
parent 4fbe73e0b7
commit e46f8b23dd
No known key found for this signature in database
GPG key ID: B80E19E4662B5AA4
11 changed files with 85 additions and 34 deletions

View file

@ -687,6 +687,14 @@ where
break;
}
// FIXME(jhpratt) remove this eventually
if attr.has_name(sym::rustc_deprecated) {
diagnostic
.struct_span_err(attr.span, "`#[rustc_deprecated]` has been removed")
.help("use `#[deprecated]` instead")
.emit();
}
let Some(meta) = attr.meta() else {
continue;
};
@ -742,12 +750,24 @@ where
continue 'outer;
}
}
// FIXME(jhpratt) remove this after a bootstrap occurs. Emitting an
// error specific to the renaming would be a good idea as well.
// FIXME(jhpratt) remove this eventually
sym::reason if attr.has_name(sym::rustc_deprecated) => {
if !get(mi, &mut note) {
continue 'outer;
}
let mut diag = diagnostic
.struct_span_err(mi.span, "`reason` has been renamed");
match note {
Some(note) => diag.span_suggestion(
mi.span,
"use `note` instead",
format!("note = \"{note}\""),
Applicability::MachineApplicable,
),
None => diag.span_help(mi.span, "use `note` instead"),
};
diag.emit();
}
sym::suggestion => {
if !sess.features_untracked().deprecated_suggestion {