-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add well known values to --check-cfg implementation
- Loading branch information
Showing
7 changed files
with
196 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
// Check that a an empty values() pass | ||
// Check warning for unexpected cfg value | ||
// | ||
// check-pass | ||
// compile-flags: --check-cfg=values() -Z unstable-options | ||
|
||
#[cfg(test = "value")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
pub fn f() {} | ||
|
||
fn main() {} |
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,11 @@ | ||
warning: unexpected `cfg` condition value | ||
--> $DIR/empty-values.rs:6:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
= note: no expected value for `test` | ||
|
||
warning: 1 warning emitted | ||
|
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,28 @@ | ||
// This test check that we lint on non well known values and that we don't lint on well known | ||
// values | ||
// | ||
// check-pass | ||
// compile-flags: --check-cfg=values() -Z unstable-options | ||
|
||
#[cfg(target_os = "linuz")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn target_os_linux_misspell() {} | ||
|
||
#[cfg(target_os = "linux")] | ||
fn target_os_linux() {} | ||
|
||
#[cfg(target_has_atomic = "0")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn target_has_atomic_invalid() {} | ||
|
||
#[cfg(target_has_atomic = "8")] | ||
fn target_has_atomic() {} | ||
|
||
#[cfg(unix = "aa")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn unix_with_value() {} | ||
|
||
#[cfg(unix)] | ||
fn unix() {} | ||
|
||
fn main() {} |
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,31 @@ | ||
warning: unexpected `cfg` condition value | ||
--> $DIR/well-known-values.rs:7:7 | ||
| | ||
LL | #[cfg(target_os = "linuz")] | ||
| ^^^^^^^^^^^^------- | ||
| | | ||
| help: did you mean: `"linux"` | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
= note: expected values for `target_os` are: android, cuda, dragonfly, emscripten, espidf, freebsd, fuchsia, haiku, hermit, horizon, illumos, ios, l4re, linux, macos, netbsd, none, openbsd, psp, redox, solaris, solid_asp3, tvos, uefi, unknown, vxworks, wasi, windows | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/well-known-values.rs:14:7 | ||
| | ||
LL | #[cfg(target_has_atomic = "0")] | ||
| ^^^^^^^^^^^^^^^^^^^^--- | ||
| | | ||
| help: did you mean: `"8"` | ||
| | ||
= note: expected values for `target_has_atomic` are: 128, 16, 32, 64, 8, ptr | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/well-known-values.rs:21:7 | ||
| | ||
LL | #[cfg(unix = "aa")] | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: no expected value for `unix` | ||
|
||
warning: 3 warnings emitted | ||
|