Skip to content

Commit f01d418

Browse files
authored
Rollup merge of rust-lang#134300 - RalfJung:remove-dead-attrs, r=chenyukang
remove long-deprecated no-op attributes no_start and crate_id These have emitted a deprecation warning since forever (rust-lang#64471) and they already don't do anything. In fact they [apparently](rust-lang#64471 (comment)) have done nothing since pre-1.0, so... do we even need a crater run? Doesn't seem worth it.
2 parents f7cc13a + a99778c commit f01d418

File tree

7 files changed

+163
-215
lines changed

7 files changed

+163
-215
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

-6
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
408408
crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk,
409409
EncodeCrossCrate::No,
410410
),
411-
// crate_id is deprecated
412-
ungated!(
413-
crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing,
414-
EncodeCrossCrate::No,
415-
),
416411

417412
// ABI, linking, symbols, and FFI
418413
ungated!(
@@ -448,7 +443,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
448443
),
449444

450445
// Entry point:
451-
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
452446
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
453447

454448
// Modules, prelude, and resolution:

compiler/rustc_lint/messages.ftl

-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ lint_builtin_const_no_mangle = const items should never be `#[no_mangle]`
6969
7070
lint_builtin_decl_unsafe_fn = declaration of an `unsafe` function
7171
lint_builtin_decl_unsafe_method = declaration of an `unsafe` method
72-
lint_builtin_deprecated_attr_default_suggestion = remove this attribute
7372
7473
lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
7574
.msg_suggestion = {$msg}
7675
.default_suggestion = remove this attribute
77-
lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
7876
lint_builtin_deref_nullptr = dereferencing a null pointer
7977
.label = this code causes undefined behavior when executed
8078

compiler/rustc_lint/src/builtin.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_abi::BackendRepr;
2020
use rustc_ast::tokenstream::{TokenStream, TokenTree};
2121
use rustc_ast::visit::{FnCtxt, FnKind};
2222
use rustc_ast::{self as ast, *};
23-
use rustc_ast_pretty::pprust::{self, expr_to_string};
23+
use rustc_ast_pretty::pprust::expr_to_string;
2424
use rustc_errors::{Applicability, LintDiagnostic};
2525
use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes};
2626
use rustc_hir as hir;
@@ -49,7 +49,7 @@ use rustc_trait_selection::traits::{self};
4949
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
5050
use crate::lints::{
5151
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
52-
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
52+
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr,
5353
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
5454
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
5555
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
@@ -848,12 +848,6 @@ impl EarlyLintPass for DeprecatedAttr {
848848
return;
849849
}
850850
}
851-
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
852-
cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
853-
name: pprust::path_to_string(&attr.get_normal_item().path),
854-
suggestion: attr.span,
855-
});
856-
}
857851
}
858852
}
859853

compiler/rustc_lint/src/lints.rs

-13
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,6 @@ pub(crate) enum BuiltinDeprecatedAttrLinkSuggestion<'a> {
177177
},
178178
}
179179

180-
#[derive(LintDiagnostic)]
181-
#[diag(lint_builtin_deprecated_attr_used)]
182-
pub(crate) struct BuiltinDeprecatedAttrUsed {
183-
pub name: String,
184-
#[suggestion(
185-
lint_builtin_deprecated_attr_default_suggestion,
186-
style = "short",
187-
code = "",
188-
applicability = "machine-applicable"
189-
)]
190-
pub suggestion: Span,
191-
}
192-
193180
#[derive(LintDiagnostic)]
194181
#[diag(lint_builtin_unused_doc_comment)]
195182
pub(crate) struct BuiltinUnusedDocComment<'a> {

compiler/rustc_span/src/symbol.rs

-2
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ symbols! {
707707
coverage,
708708
coverage_attribute,
709709
cr,
710-
crate_id,
711710
crate_in_paths,
712711
crate_local,
713712
crate_name,
@@ -1390,7 +1389,6 @@ symbols! {
13901389
no_mangle,
13911390
no_sanitize,
13921391
no_stack_check,
1393-
no_start,
13941392
no_std,
13951393
nomem,
13961394
non_ascii_idents,

tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs

-9
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,11 @@
8181
#![crate_name = "0900"]
8282
#![crate_type = "bin"] // cannot pass "0800" here
8383

84-
#![crate_id = "10"]
85-
//~^ WARN use of deprecated attribute
86-
//~| HELP remove this attribute
87-
//~| NOTE `#[warn(deprecated)]` on by default
88-
8984
// FIXME(#44232) we should warn that this isn't used.
9085
#![feature(rust1)]
9186
//~^ WARN no longer requires an attribute to enable
9287
//~| NOTE `#[warn(stable_features)]` on by default
9388

94-
#![no_start]
95-
//~^ WARN use of deprecated attribute
96-
//~| HELP remove this attribute
97-
9889
// (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
9990
#![no_builtins]
10091
#![recursion_limit = "0200"]

0 commit comments

Comments
 (0)