Skip to content

Commit f9444bb

Browse files
committed
remove long-deprecated no-op attributes no_start and crate_id
1 parent a1740a9 commit f9444bb

File tree

7 files changed

+163
-215
lines changed

7 files changed

+163
-215
lines changed

Diff for: compiler/rustc_feature/src/builtin_attrs.rs

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

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

449444
// Entry point:
450445
ungated!(start, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
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:

Diff for: 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

Diff for: 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;
@@ -50,7 +50,7 @@ use rustc_trait_selection::traits::{self};
5050
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
5151
use crate::lints::{
5252
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
53-
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
53+
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr,
5454
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
5555
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
5656
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
@@ -849,12 +849,6 @@ impl EarlyLintPass for DeprecatedAttr {
849849
return;
850850
}
851851
}
852-
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
853-
cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
854-
name: pprust::path_to_string(&attr.get_normal_item().path),
855-
suggestion: attr.span,
856-
});
857-
}
858852
}
859853
}
860854

Diff for: 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> {

Diff for: compiler/rustc_span/src/symbol.rs

-2
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,6 @@ symbols! {
688688
coverage,
689689
coverage_attribute,
690690
cr,
691-
crate_id,
692691
crate_in_paths,
693692
crate_local,
694693
crate_name,
@@ -1367,7 +1366,6 @@ symbols! {
13671366
no_mangle,
13681367
no_sanitize,
13691368
no_stack_check,
1370-
no_start,
13711369
no_std,
13721370
nomem,
13731371
non_ascii_idents,

Diff for: 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)