1
Fork 0

New deprecated_suggestion feature, use in tests

This commit is contained in:
Jacob Pratt 2022-02-16 18:48:33 -05:00
parent 6efc8e34d8
commit 5636655d0f
No known key found for this signature in database
GPG key ID: B80E19E4662B5AA4
10 changed files with 40 additions and 8 deletions

View file

@ -741,7 +741,19 @@ where
continue 'outer;
}
}
sym::suggestion if attr.has_name(sym::rustc_deprecated) => {
sym::suggestion => {
if !sess.features_untracked().deprecated_suggestion {
let mut diag = sess.struct_span_err(
mi.span,
"suggestions on deprecated items are unstable",
);
if sess.is_nightly_build() {
diag.help("add `#![feature(deprecated_suggestion)]` to the crate root");
}
// FIXME(jhpratt) change this to an actual tracking issue
diag.note("see #XXX for more details").emit();
}
if !get(mi, &mut suggestion) {
continue 'outer;
}
@ -778,10 +790,6 @@ where
}
}
if suggestion.is_some() && attr.has_name(sym::deprecated) {
unreachable!("only allowed on rustc_deprecated")
}
if attr.has_name(sym::rustc_deprecated) {
if since.is_none() {
handle_errors(&sess.parse_sess, attr.span, AttrError::MissingSince);