-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
12 changed files
with
60 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error: `crate_type` within an `#![cfg_attr]` attribute is forbidden | ||
--> $DIR/crate-attributes-using-cfg_attr.rs:4:18 | ||
| | ||
LL | #![cfg_attr(foo, crate_type="bin")] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: `crate_name` within an `#![cfg_attr]` attribute is forbidden | ||
--> $DIR/crate-attributes-using-cfg_attr.rs:7:18 | ||
| | ||
LL | #![cfg_attr(foo, crate_name="bar")] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: `crate_type` within an `#![cfg_attr]` attribute is forbidden | ||
--> $DIR/crate-attributes-using-cfg_attr.rs:4:18 | ||
| | ||
LL | #![cfg_attr(foo, crate_type="bin")] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: `crate_name` within an `#![cfg_attr]` attribute is forbidden | ||
--> $DIR/crate-attributes-using-cfg_attr.rs:7:18 | ||
| | ||
LL | #![cfg_attr(foo, crate_name="bar")] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 4 previous errors | ||
|
41 changes: 0 additions & 41 deletions
41
tests/ui/cfg/future-compat-crate-attributes-using-cfg_attr.stderr
This file was deleted.
Oops, something went wrong.