-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
#[cfg]: suggest alternative target_ name when the value does not match
#154777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
| #![deny(unexpected_cfgs)] | ||
| //~^ NOTE lint level is defined here | ||
|
|
||
| // target arch used in `target_abi` | ||
| #[cfg(target_abi = "arm")] | ||
| //~^ ERROR unexpected `cfg` condition value: | ||
| //~| NOTE see <https://doc.rust-lang.org | ||
| //~| HELP `arm` is an expected value for `target_arch` | ||
| struct A; | ||
|
|
||
| // target env used in `target_arch` | ||
| #[cfg(target_arch = "gnu")] | ||
| //~^ ERROR unexpected `cfg` condition value: | ||
| //~| NOTE see <https://doc.rust-lang.org | ||
| //~| HELP `gnu` is an expected value for `target_env` | ||
| struct B; | ||
|
|
||
| // target os used in `target_env` | ||
| #[cfg(target_env = "openbsd")] | ||
| //~^ ERROR unexpected `cfg` condition value: | ||
| //~| NOTE see <https://doc.rust-lang.org | ||
| //~| HELP `openbsd` is an expected value for `target_os` | ||
| struct C; | ||
|
|
||
| // target abi used in `target_os` | ||
| #[cfg(target_os = "eabi")] | ||
| //~^ ERROR unexpected `cfg` condition value: | ||
scrabsha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| //~| NOTE see <https://doc.rust-lang.org | ||
| //~| HELP `eabi` is an expected value for `target_abi` | ||
| struct D; | ||
|
|
||
| #[cfg(target_abi = "windows")] | ||
| //~^ ERROR unexpected `cfg` condition value: | ||
| //~| NOTE see <https://doc.rust-lang.org | ||
| //~| HELP `windows` is an expected value for `target_os` | ||
| //~| HELP `windows` is an expected value for `target_family` | ||
| struct E; | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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,77 @@ | ||
| error: unexpected `cfg` condition value: `arm` | ||
| --> $DIR/suggest-alternative-name-on-target.rs:5:7 | ||
| | | ||
| LL | #[cfg(target_abi = "arm")] | ||
| | ^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| note: the lint level is defined here | ||
| --> $DIR/suggest-alternative-name-on-target.rs:1:9 | ||
| | | ||
| LL | #![deny(unexpected_cfgs)] | ||
| | ^^^^^^^^^^^^^^^ | ||
| help: `arm` is an expected value for `target_arch` | ||
| | | ||
| LL - #[cfg(target_abi = "arm")] | ||
| LL + #[cfg(target_arch = "arm")] | ||
| | | ||
|
|
||
| error: unexpected `cfg` condition value: `gnu` | ||
| --> $DIR/suggest-alternative-name-on-target.rs:12:7 | ||
| | | ||
| LL | #[cfg(target_arch = "gnu")] | ||
| | ^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: `gnu` is an expected value for `target_env` | ||
| | | ||
| LL - #[cfg(target_arch = "gnu")] | ||
| LL + #[cfg(target_env = "gnu")] | ||
| | | ||
|
|
||
| error: unexpected `cfg` condition value: `openbsd` | ||
| --> $DIR/suggest-alternative-name-on-target.rs:19:7 | ||
| | | ||
| LL | #[cfg(target_env = "openbsd")] | ||
| | ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: `openbsd` is an expected value for `target_os` | ||
| | | ||
| LL - #[cfg(target_env = "openbsd")] | ||
| LL + #[cfg(target_os = "openbsd")] | ||
| | | ||
|
|
||
| error: unexpected `cfg` condition value: `eabi` | ||
| --> $DIR/suggest-alternative-name-on-target.rs:26:7 | ||
| | | ||
| LL | #[cfg(target_os = "eabi")] | ||
| | ^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: `eabi` is an expected value for `target_abi` | ||
| | | ||
| LL - #[cfg(target_os = "eabi")] | ||
| LL + #[cfg(target_abi = "eabi")] | ||
| | | ||
|
|
||
| error: unexpected `cfg` condition value: `windows` | ||
| --> $DIR/suggest-alternative-name-on-target.rs:32:7 | ||
| | | ||
| LL | #[cfg(target_abi = "windows")] | ||
| | ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration | ||
| help: `windows` is an expected value for `target_os` | ||
| | | ||
| LL - #[cfg(target_abi = "windows")] | ||
| LL + #[cfg(target_os = "windows")] | ||
| | | ||
| help: `windows` is an expected value for `target_family` | ||
| | | ||
| LL - #[cfg(target_abi = "windows")] | ||
| LL + #[cfg(target_family = "windows")] | ||
| | | ||
|
|
||
| error: aborting due to 5 previous errors | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.