Rollup merge of #98115 - jhpratt:remove-rustc_deprecated, r=compiler-errors

Remove `rustc_deprecated` diagnostics

Follow-up on #95960. The diagnostics will remain until the next bootstrap, at which point people will have had six weeks to adjust.

``@rustbot`` label +A-diagnostics

r? ``@compiler-errors``
This commit is contained in:
Yuki Okushi 2022-06-15 19:37:15 +09:00 committed by GitHub
commit b1e5472349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 166 additions and 237 deletions

View File

@ -406,8 +406,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
// Emit errors for non-staged-api crates.
if !self.features.staged_api {
if attr.has_name(sym::rustc_deprecated)
|| attr.has_name(sym::unstable)
if attr.has_name(sym::unstable)
|| attr.has_name(sym::stable)
|| attr.has_name(sym::rustc_const_unstable)
|| attr.has_name(sym::rustc_const_stable)

View File

@ -720,18 +720,10 @@ where
let is_rustc = sess.features_untracked().staged_api;
'outer: for attr in attrs_iter {
if !(attr.has_name(sym::deprecated) || attr.has_name(sym::rustc_deprecated)) {
if !attr.has_name(sym::deprecated) {
continue;
}
// 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;
};
@ -787,25 +779,6 @@ where
continue 'outer;
}
}
// 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 {
let mut diag = sess.struct_span_err(

View File

@ -489,11 +489,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// ==========================================================================
ungated!(feature, CrateLevel, template!(List: "name1, name2, ..."), DuplicatesOk),
// FIXME(jhpratt) remove this eventually
ungated!(
rustc_deprecated, Normal,
template!(List: r#"since = "version", note = "...""#), ErrorFollowing
),
// DuplicatesOk since it has its own validation
ungated!(
stable, Normal, template!(List: r#"feature = "name", since = "version""#), DuplicatesOk,

View File

@ -152,9 +152,7 @@ impl CheckAttrVisitor<'_> {
sym::link_name => self.check_link_name(hir_id, attr, span, target),
sym::link_section => self.check_link_section(hir_id, attr, span, target),
sym::no_mangle => self.check_no_mangle(hir_id, attr, span, target),
sym::deprecated | sym::rustc_deprecated => {
self.check_deprecated(hir_id, attr, span, target)
}
sym::deprecated => self.check_deprecated(hir_id, attr, span, target),
sym::macro_use | sym::macro_escape => self.check_macro_use(hir_id, attr, target),
sym::path => self.check_generic_attr(hir_id, attr, target, &[Target::Mod]),
sym::plugin_registrar => self.check_plugin_registrar(hir_id, attr, target),

View File

@ -1188,7 +1188,6 @@ symbols! {
rustc_const_unstable,
rustc_conversion_suggestion,
rustc_def_path,
rustc_deprecated,
rustc_diagnostic_item,
rustc_diagnostic_macros,
rustc_dirty,

View File

@ -1,13 +0,0 @@
// compile-flags: --crate-type=lib
#![feature(staged_api)]
#![stable(since = "1.0.0", feature = "rust1")]
#[rustc_deprecated( //~ ERROR `#[rustc_deprecated]` has been removed
//~^ HELP use `#[deprecated]` instead
since = "1.100.0",
reason = "text" //~ ERROR `reason` has been renamed
//~^ HELP use `note` instead
)]
#[stable(feature = "rust1", since = "1.0.0")]
fn foo() {}

View File

@ -1,21 +0,0 @@
error: `#[rustc_deprecated]` has been removed
--> $DIR/rustc_deprecated.rs:6:1
|
LL | / #[rustc_deprecated(
LL | |
LL | | since = "1.100.0",
LL | | reason = "text"
LL | |
LL | | )]
| |__^
|
= help: use `#[deprecated]` instead
error: `reason` has been renamed
--> $DIR/rustc_deprecated.rs:9:5
|
LL | reason = "text"
| ^^^^^^^^^^^^^^^ help: use `note` instead: `note = "text"`
error: aborting due to 2 previous errors

View File

@ -69,7 +69,6 @@
#![link_section = "1800"]
//~^ WARN attribute should be applied to a function or static
//~^^ WARN this was previously accepted by the compiler
// see issue-43106-gating-of-rustc_deprecated.rs
#![must_use]
//~^ WARN `#[must_use]` has no effect
// see issue-43106-gating-of-stable.rs