remove long-deprecated no-op attributes no_start and crate_id
This commit is contained in:
parent
ed43cbcb88
commit
a99778c839
7 changed files with 163 additions and 215 deletions
|
@ -408,11 +408,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk,
|
||||
EncodeCrossCrate::No,
|
||||
),
|
||||
// crate_id is deprecated
|
||||
ungated!(
|
||||
crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing,
|
||||
EncodeCrossCrate::No,
|
||||
),
|
||||
|
||||
// ABI, linking, symbols, and FFI
|
||||
ungated!(
|
||||
|
@ -448,7 +443,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
),
|
||||
|
||||
// Entry point:
|
||||
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
|
||||
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No),
|
||||
|
||||
// Modules, prelude, and resolution:
|
||||
|
|
|
@ -69,12 +69,10 @@ lint_builtin_const_no_mangle = const items should never be `#[no_mangle]`
|
|||
|
||||
lint_builtin_decl_unsafe_fn = declaration of an `unsafe` function
|
||||
lint_builtin_decl_unsafe_method = declaration of an `unsafe` method
|
||||
lint_builtin_deprecated_attr_default_suggestion = remove this attribute
|
||||
|
||||
lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link}
|
||||
.msg_suggestion = {$msg}
|
||||
.default_suggestion = remove this attribute
|
||||
lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used
|
||||
lint_builtin_deref_nullptr = dereferencing a null pointer
|
||||
.label = this code causes undefined behavior when executed
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use rustc_abi::BackendRepr;
|
|||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_ast::visit::{FnCtxt, FnKind};
|
||||
use rustc_ast::{self as ast, *};
|
||||
use rustc_ast_pretty::pprust::{self, expr_to_string};
|
||||
use rustc_ast_pretty::pprust::expr_to_string;
|
||||
use rustc_errors::{Applicability, LintDiagnostic};
|
||||
use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes};
|
||||
use rustc_hir as hir;
|
||||
|
@ -49,7 +49,7 @@ use rustc_trait_selection::traits::{self};
|
|||
use crate::errors::BuiltinEllipsisInclusiveRangePatterns;
|
||||
use crate::lints::{
|
||||
BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink,
|
||||
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr,
|
||||
BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr,
|
||||
BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives,
|
||||
BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures,
|
||||
BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents,
|
||||
|
@ -848,12 +848,6 @@ impl EarlyLintPass for DeprecatedAttr {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
|
||||
cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
|
||||
name: pprust::path_to_string(&attr.get_normal_item().path),
|
||||
suggestion: attr.span,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,19 +176,6 @@ pub(crate) enum BuiltinDeprecatedAttrLinkSuggestion<'a> {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_builtin_deprecated_attr_used)]
|
||||
pub(crate) struct BuiltinDeprecatedAttrUsed {
|
||||
pub name: String,
|
||||
#[suggestion(
|
||||
lint_builtin_deprecated_attr_default_suggestion,
|
||||
style = "short",
|
||||
code = "",
|
||||
applicability = "machine-applicable"
|
||||
)]
|
||||
pub suggestion: Span,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_builtin_unused_doc_comment)]
|
||||
pub(crate) struct BuiltinUnusedDocComment<'a> {
|
||||
|
|
|
@ -707,7 +707,6 @@ symbols! {
|
|||
coverage,
|
||||
coverage_attribute,
|
||||
cr,
|
||||
crate_id,
|
||||
crate_in_paths,
|
||||
crate_local,
|
||||
crate_name,
|
||||
|
@ -1389,7 +1388,6 @@ symbols! {
|
|||
no_mangle,
|
||||
no_sanitize,
|
||||
no_stack_check,
|
||||
no_start,
|
||||
no_std,
|
||||
nomem,
|
||||
non_ascii_idents,
|
||||
|
|
|
@ -81,20 +81,11 @@
|
|||
#![crate_name = "0900"]
|
||||
#![crate_type = "bin"] // cannot pass "0800" here
|
||||
|
||||
#![crate_id = "10"]
|
||||
//~^ WARN use of deprecated attribute
|
||||
//~| HELP remove this attribute
|
||||
//~| NOTE `#[warn(deprecated)]` on by default
|
||||
|
||||
// FIXME(#44232) we should warn that this isn't used.
|
||||
#![feature(rust1)]
|
||||
//~^ WARN no longer requires an attribute to enable
|
||||
//~| NOTE `#[warn(stable_features)]` on by default
|
||||
|
||||
#![no_start]
|
||||
//~^ WARN use of deprecated attribute
|
||||
//~| HELP remove this attribute
|
||||
|
||||
// (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
|
||||
#![no_builtins]
|
||||
#![recursion_limit = "0200"]
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue