Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rustc_deprecated diagnostics #98115

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 1 addition & 28 deletions compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,6 @@ symbols! {
rustc_const_unstable,
rustc_conversion_suggestion,
rustc_def_path,
rustc_deprecated,
rustc_diagnostic_item,
rustc_diagnostic_macros,
rustc_dirty,
Expand Down
13 changes: 0 additions & 13 deletions src/test/ui/deprecation/rustc_deprecated.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/ui/deprecation/rustc_deprecated.stderr

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading