Auto merge of #129670 - est31:cfg_attr_crate_type_name_error, r=Urgau
Make deprecated_cfg_attr_crate_type_name a hard error Turns the forward compatibility lint added by #83744 into a hard error, so now, while the `#![crate_name]` and `#![crate_type]` attributes are still allowed in raw form, they are now forbidden to be nested inside a `#![cfg_attr()]` attribute. The following will now be an error: ```Rust #![cfg_attr(foo, crate_name = "foobar")] #![cfg_attr(foo, crate_type = "bin")] ``` This code will continue working and is not deprecated: ```Rust #![crate_name = "foobar"] #![crate_type = "lib"] ``` The reasoning for this is explained in #83744: it allows us to not have to cfg-expand in order to determine the crate's type and name. As of filing the PR, exactly two years have passed since #99784 has been merged, which has turned the lint's default warning level into an error, so there has been ample time to move off the now-forbidden syntax. cc #91632 - tracking issue for the lint
This commit is contained in:
commit
8422e27b27
12 changed files with 60 additions and 118 deletions
|
@ -400,12 +400,6 @@ pub(super) fn decorate_lint(sess: &Session, diagnostic: BuiltinLintDiag, diag: &
|
|||
BuiltinLintDiag::CfgAttrNoAttributes => {
|
||||
lints::CfgAttrNoAttributes.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::CrateTypeInCfgAttr => {
|
||||
lints::CrateTypeInCfgAttr.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::CrateNameInCfgAttr => {
|
||||
lints::CrateNameInCfgAttr.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::MissingFragmentSpecifier => {
|
||||
lints::MissingFragmentSpecifier.decorate_lint(diag);
|
||||
}
|
||||
|
|
|
@ -569,6 +569,11 @@ fn register_builtins(store: &mut LintStore) {
|
|||
"converted into hard error, see RFC #3535 \
|
||||
<https://rust-lang.github.io/rfcs/3535-constants-in-patterns.html> for more information",
|
||||
);
|
||||
store.register_removed(
|
||||
"deprecated_cfg_attr_crate_type_name",
|
||||
"converted into hard error, see issue #91632 \
|
||||
<https://github.com/rust-lang/rust/issues/91632> for more information",
|
||||
);
|
||||
store.register_removed(
|
||||
"pointer_structural_match",
|
||||
"converted into hard error, see RFC #3535 \
|
||||
|
|
|
@ -2441,14 +2441,6 @@ pub(crate) struct DuplicateMacroAttribute;
|
|||
#[diag(lint_cfg_attr_no_attributes)]
|
||||
pub(crate) struct CfgAttrNoAttributes;
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_crate_type_in_cfg_attr_deprecated)]
|
||||
pub(crate) struct CrateTypeInCfgAttr;
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_crate_name_in_cfg_attr_deprecated)]
|
||||
pub(crate) struct CrateNameInCfgAttr;
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_missing_fragment_specifier)]
|
||||
pub(crate) struct MissingFragmentSpecifier;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue