Stabilize checking of cfgs at compile-time: --check-cfg option

This commit is contained in:
Urgau 2024-02-25 14:56:14 +01:00
parent 99d0186b1d
commit 909fcfcb6a
55 changed files with 60 additions and 95 deletions

View File

@ -1373,7 +1373,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
opt::flag_s("h", "help", "Display this message"),
opt::multi_s("", "cfg", "Configure the compilation environment.
SPEC supports the syntax `NAME[=\"VALUE\"]`.", "SPEC"),
opt::multi("", "check-cfg", "Provide list of valid cfg options for checking", "SPEC"),
opt::multi_s("", "check-cfg", "Provide list of expected cfgs for checking", "SPEC"),
opt::multi_s(
"L",
"",

View File

@ -60,11 +60,8 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) ->
for cfg in &options.cfgs {
content.push(format!("--cfg={cfg}"));
}
if !options.check_cfgs.is_empty() {
content.push("-Zunstable-options".to_string());
for check_cfg in &options.check_cfgs {
content.push(format!("--check-cfg={check_cfg}"));
}
for check_cfg in &options.check_cfgs {
content.push(format!("--check-cfg={check_cfg}"));
}
for lib_str in &options.lib_strs {

View File

@ -242,7 +242,7 @@ fn opts() -> Vec<RustcOptGroup> {
o.optmulti("L", "library-path", "directory to add to crate search path", "DIR")
}),
stable("cfg", |o| o.optmulti("", "cfg", "pass a --cfg to rustc", "")),
unstable("check-cfg", |o| o.optmulti("", "check-cfg", "pass a --check-cfg to rustc", "")),
stable("check-cfg", |o| o.optmulti("", "check-cfg", "pass a --check-cfg to rustc", "")),
stable("extern", |o| o.optmulti("", "extern", "pass an --extern to rustc", "NAME[=PATH]")),
unstable("extern-html-root-url", |o| {
o.optmulti(

View File

@ -1,5 +1,5 @@
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
/// uniz is nor a builtin nor pass as arguments so is unexpected
#[cfg(uniz)]

View File

@ -1,11 +0,0 @@
warning: unexpected `cfg` condition value
--> $DIR/check-cfg-test.rs:9:7
|
LL | #[cfg(feature = "invalid")]
| ^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: test
= note: `#[warn(unexpected_cfgs)]` on by default
warning: 1 warning emitted

View File

@ -1,2 +0,0 @@
//@ check-fail
//@ compile-flags: --check-cfg=cfg()

View File

@ -1,2 +0,0 @@
error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`

View File

@ -1,7 +1,7 @@
// This test check that #![allow(unexpected_cfgs)] works with --cfg
//
//@ check-pass
//@ compile-flags: --cfg=unexpected --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --cfg=unexpected --check-cfg=cfg()
#![allow(unexpected_cfgs)]

View File

@ -1,7 +1,7 @@
// This test check that local #[allow(unexpected_cfgs)] works
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[allow(unexpected_cfgs)]
fn foo() {

View File

@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[allow(unexpected_cfgs)]
#[cfg(FALSE)]

View File

@ -1,7 +1,7 @@
// This test check that a top-level #![allow(unexpected_cfgs)] works
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#![allow(unexpected_cfgs)]

View File

@ -1,7 +1,7 @@
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[allow(unexpected_cfgs)]
mod aa {

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `serde`
--> $DIR/cargo-feature.rs:14:7
--> $DIR/cargo-feature.rs:13:7
|
LL | #[cfg(feature = "serde")]
| ^^^^^^^^^^^^^^^^^ help: remove the condition
@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: (none)
--> $DIR/cargo-feature.rs:18:7
--> $DIR/cargo-feature.rs:17:7
|
LL | #[cfg(feature)]
| ^^^^^^^ help: remove the condition
@ -20,7 +20,7 @@ LL | #[cfg(feature)]
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `tokio_unstable`
--> $DIR/cargo-feature.rs:22:7
--> $DIR/cargo-feature.rs:21:7
|
LL | #[cfg(tokio_unstable)]
| ^^^^^^^^^^^^^^
@ -30,7 +30,7 @@ LL | #[cfg(tokio_unstable)]
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `CONFIG_NVME`
--> $DIR/cargo-feature.rs:26:7
--> $DIR/cargo-feature.rs:25:7
|
LL | #[cfg(CONFIG_NVME = "m")]
| ^^^^^^^^^^^^^^^^^

View File

@ -5,7 +5,6 @@
//@ check-pass
//@ revisions: some none
//@ rustc-env:CARGO_CRATE_NAME=foo
//@ compile-flags: -Z unstable-options
//@ [none]compile-flags: --check-cfg=cfg(feature,values())
//@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
//@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `serde`
--> $DIR/cargo-feature.rs:14:7
--> $DIR/cargo-feature.rs:13:7
|
LL | #[cfg(feature = "serde")]
| ^^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | #[cfg(feature = "serde")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: (none)
--> $DIR/cargo-feature.rs:18:7
--> $DIR/cargo-feature.rs:17:7
|
LL | #[cfg(feature)]
| ^^^^^^^- help: specify a config value: `= "bitcode"`
@ -20,7 +20,7 @@ LL | #[cfg(feature)]
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `tokio_unstable`
--> $DIR/cargo-feature.rs:22:7
--> $DIR/cargo-feature.rs:21:7
|
LL | #[cfg(tokio_unstable)]
| ^^^^^^^^^^^^^^
@ -30,7 +30,7 @@ LL | #[cfg(tokio_unstable)]
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `m`
--> $DIR/cargo-feature.rs:26:7
--> $DIR/cargo-feature.rs:25:7
|
LL | #[cfg(CONFIG_NVME = "m")]
| ^^^^^^^^^^^^^^---

View File

@ -2,7 +2,6 @@
// This test checks we won't suggest more than 3 span suggestions for cfg names
//
//@ check-pass
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(foo,values("value")) --check-cfg=cfg(bar,values("value")) --check-cfg=cfg(bee,values("value")) --check-cfg=cfg(cow,values("value"))
#[cfg(value)]

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `value`
--> $DIR/cfg-value-for-cfg-name-duplicate.rs:8:7
--> $DIR/cfg-value-for-cfg-name-duplicate.rs:7:7
|
LL | #[cfg(value)]
| ^^^^^

View File

@ -2,7 +2,6 @@
// This test checks that when a single cfg has a value for user's specified name
//
//@ check-pass
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(foo,values("my_value")) --check-cfg=cfg(bar,values("my_value"))
#[cfg(my_value)]

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `my_value`
--> $DIR/cfg-value-for-cfg-name-multiple.rs:8:7
--> $DIR/cfg-value-for-cfg-name-multiple.rs:7:7
|
LL | #[cfg(my_value)]
| ^^^^^^^^

View File

@ -3,7 +3,6 @@
// suggest to use `#[cfg(target_os = "linux")]` instead of `#[cfg(linux)]`
//
//@ check-pass
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[cfg(linux)]

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `linux`
--> $DIR/cfg-value-for-cfg-name.rs:9:7
--> $DIR/cfg-value-for-cfg-name.rs:8:7
|
LL | #[cfg(linux)]
| ^^^^^ help: found config with similar value: `target_os = "linux"`
@ -10,7 +10,7 @@ LL | #[cfg(linux)]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `linux`
--> $DIR/cfg-value-for-cfg-name.rs:14:7
--> $DIR/cfg-value-for-cfg-name.rs:13:7
|
LL | #[cfg(linux = "os-name")]
| ^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#![feature(cfg_target_compact)]

View File

@ -1,7 +1,7 @@
// This test check that we correctly emit an warning for compact cfg
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#![feature(cfg_target_compact)]

View File

@ -1,5 +1,4 @@
//@ check-pass
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(my_cfg,values("foo")) --check-cfg=cfg(my_cfg,values("bar"))
//@ compile-flags: --check-cfg=cfg(my_cfg,values())

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: (none)
--> $DIR/concat-values.rs:6:7
--> $DIR/concat-values.rs:5:7
|
LL | #[cfg(my_cfg)]
| ^^^^^^
@ -10,7 +10,7 @@ LL | #[cfg(my_cfg)]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `unk`
--> $DIR/concat-values.rs:10:7
--> $DIR/concat-values.rs:9:7
|
LL | #[cfg(my_cfg = "unk")]
| ^^^^^^^^^^^^^^

View File

@ -2,7 +2,7 @@
//@ revisions: cargo rustc
//@ [rustc]unset-rustc-env:CARGO_CRATE_NAME
//@ [cargo]rustc-env:CARGO_CRATE_NAME=foo
//@ compile-flags: --check-cfg=cfg(feature,values("foo")) --check-cfg=cfg(no_values) -Z unstable-options
//@ compile-flags: --check-cfg=cfg(feature,values("foo")) --check-cfg=cfg(no_values)
#[cfg(featur)]
//~^ WARNING unexpected `cfg` condition name

View File

@ -1,7 +1,7 @@
// Check that we detect unexpected value when none are allowed
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg(foo,values()) -Zunstable-options
//@ compile-flags: --check-cfg=cfg(foo,values())
#[cfg(foo = "foo")]
//~^ WARNING unexpected `cfg` condition value

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `unknown_key`
--> $DIR/exhaustive-names-values.rs:10:7
--> $DIR/exhaustive-names-values.rs:9:7
|
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | #[cfg(unknown_key = "value")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `value`
--> $DIR/exhaustive-names-values.rs:14:7
--> $DIR/exhaustive-names-values.rs:13:7
|
LL | #[cfg(test = "value")]
| ^^^^----------
@ -21,7 +21,7 @@ LL | #[cfg(test = "value")]
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `feature`
--> $DIR/exhaustive-names-values.rs:18:7
--> $DIR/exhaustive-names-values.rs:17:7
|
LL | #[cfg(feature = "unk")]
| ^^^^^^^^^^^^^^^
@ -30,7 +30,7 @@ LL | #[cfg(feature = "unk")]
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `feature`
--> $DIR/exhaustive-names-values.rs:25:7
--> $DIR/exhaustive-names-values.rs:24:7
|
LL | #[cfg(feature = "std")]
| ^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `unknown_key`
--> $DIR/exhaustive-names-values.rs:10:7
--> $DIR/exhaustive-names-values.rs:9:7
|
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | #[cfg(unknown_key = "value")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `value`
--> $DIR/exhaustive-names-values.rs:14:7
--> $DIR/exhaustive-names-values.rs:13:7
|
LL | #[cfg(test = "value")]
| ^^^^----------
@ -21,7 +21,7 @@ LL | #[cfg(test = "value")]
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `unk`
--> $DIR/exhaustive-names-values.rs:18:7
--> $DIR/exhaustive-names-values.rs:17:7
|
LL | #[cfg(feature = "unk")]
| ^^^^^^^^^^^^^^^

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition name: `unknown_key`
--> $DIR/exhaustive-names-values.rs:10:7
--> $DIR/exhaustive-names-values.rs:9:7
|
LL | #[cfg(unknown_key = "value")]
| ^^^^^^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ LL | #[cfg(unknown_key = "value")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `value`
--> $DIR/exhaustive-names-values.rs:14:7
--> $DIR/exhaustive-names-values.rs:13:7
|
LL | #[cfg(test = "value")]
| ^^^^----------
@ -21,7 +21,7 @@ LL | #[cfg(test = "value")]
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `unk`
--> $DIR/exhaustive-names-values.rs:18:7
--> $DIR/exhaustive-names-values.rs:17:7
|
LL | #[cfg(feature = "unk")]
| ^^^^^^^^^^^^^^^

View File

@ -2,7 +2,6 @@
//
//@ check-pass
//@ revisions: empty_cfg feature full
//@ compile-flags: -Z unstable-options
//@ [empty_cfg]compile-flags: --check-cfg=cfg()
//@ [feature]compile-flags: --check-cfg=cfg(feature,values("std"))
//@ [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg()

View File

@ -1,7 +1,7 @@
// Check warning for unexpected cfg
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[cfg(unknown_key = "value")]
//~^ WARNING unexpected `cfg` condition name

View File

@ -2,8 +2,8 @@
//
//@ check-pass
//@ revisions: empty_cfg without_names
//@ [empty_cfg]compile-flags: --check-cfg=cfg() -Z unstable-options
//@ [without_names]compile-flags: --check-cfg=cfg(any()) -Z unstable-options
//@ [empty_cfg]compile-flags: --check-cfg=cfg()
//@ [without_names]compile-flags: --check-cfg=cfg(any())
#[cfg(test = "value")]
//~^ WARNING unexpected `cfg` condition value

View File

@ -9,7 +9,6 @@
//@ revisions: mixed_values_any mixed_any any_values giberich unterminated
//@ revisions: none_not_empty cfg_none
//
//@ compile-flags: -Z unstable-options
//@ [anything_else]compile-flags: --check-cfg=anything_else(...)
//@ [string_for_name_1]compile-flags: --check-cfg=cfg("NOT_IDENT")
//@ [string_for_name_2]compile-flags: --check-cfg=cfg(foo,"NOT_IDENT",bar)

View File

@ -3,7 +3,7 @@
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
//
//@ check-pass
//@ compile-flags: --cfg feature="bar" --cfg unknown_name -Z unstable-options
//@ compile-flags: --cfg feature="bar" --cfg unknown_name
//@ compile-flags: --check-cfg=cfg(feature,values("foo"))
#[cfg(windows)]

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:11:7
--> $DIR/no-expected-values.rs:10:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^--------
@ -12,7 +12,7 @@ LL | #[cfg(feature = "foo")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:15:7
--> $DIR/no-expected-values.rs:14:7
|
LL | #[cfg(test = "foo")]
| ^^^^--------

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:11:7
--> $DIR/no-expected-values.rs:10:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^--------
@ -12,7 +12,7 @@ LL | #[cfg(feature = "foo")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:15:7
--> $DIR/no-expected-values.rs:14:7
|
LL | #[cfg(test = "foo")]
| ^^^^--------

View File

@ -2,7 +2,6 @@
//
//@ check-pass
//@ revisions: simple mixed empty
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(values,simple,mixed,empty)
//@ [simple]compile-flags: --check-cfg=cfg(test) --check-cfg=cfg(feature)
//@ [mixed]compile-flags: --check-cfg=cfg(test,feature)

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:11:7
--> $DIR/no-expected-values.rs:10:7
|
LL | #[cfg(feature = "foo")]
| ^^^^^^^--------
@ -12,7 +12,7 @@ LL | #[cfg(feature = "foo")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `foo`
--> $DIR/no-expected-values.rs:15:7
--> $DIR/no-expected-values.rs:14:7
|
LL | #[cfg(test = "foo")]
| ^^^^--------

View File

@ -1,9 +1,7 @@
//@ check-pass
//
//@ revisions: values_before values_after
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(values_before,values_after)
//
//@ [values_before]compile-flags: --check-cfg=cfg(a,values("b")) --check-cfg=cfg(a)
//@ [values_after]compile-flags: --check-cfg=cfg(a) --check-cfg=cfg(a,values("b"))

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:13:7
--> $DIR/order-independant.rs:11:7
|
LL | #[cfg(a = "unk")]
| ^^^^^^^^^

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `unk`
--> $DIR/order-independant.rs:13:7
--> $DIR/order-independant.rs:11:7
|
LL | #[cfg(a = "unk")]
| ^^^^^^^^^

View File

@ -1,7 +1,7 @@
// This test checks that there is no ICE with this code
//
//@ check-pass
//@ compile-flags:--check-cfg=cfg() -Z unstable-options
//@ compile-flags:--check-cfg=cfg()
fn main() {
#[cfg(crossbeam_loom)]

View File

@ -1,7 +1,7 @@
// Check warning for unexpected configuration name
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[cfg(widnows)]
//~^ WARNING unexpected `cfg` condition name

View File

@ -1,7 +1,7 @@
// Check for unexpected configuration value in the code.
//
//@ check-pass
//@ compile-flags: --cfg=feature="rand" -Z unstable-options
//@ compile-flags: --cfg=feature="rand"
//@ compile-flags: --check-cfg=cfg(feature,values("serde","full"))
#[cfg(feature = "sedre")]

View File

@ -2,7 +2,6 @@
//
//@ check-pass
//@ revisions: simple mixed with_values
//@ compile-flags: -Z unstable-options
//@ compile-flags: --check-cfg=cfg(simple,mixed,with_values)
//@ [simple]compile-flags: --check-cfg=cfg(foo,values(any()))
//@ [mixed]compile-flags: --check-cfg=cfg(foo) --check-cfg=cfg(foo,values(any()))

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `too`
--> $DIR/values-none.rs:11:7
--> $DIR/values-none.rs:10:7
|
LL | #[cfg(foo = "too")]
| ^^^--------
@ -12,7 +12,7 @@ LL | #[cfg(foo = "too")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `bar`
--> $DIR/values-none.rs:16:7
--> $DIR/values-none.rs:15:7
|
LL | #[cfg(foo = "bar")]
| ^^^--------

View File

@ -1,5 +1,5 @@
warning: unexpected `cfg` condition value: `too`
--> $DIR/values-none.rs:11:7
--> $DIR/values-none.rs:10:7
|
LL | #[cfg(foo = "too")]
| ^^^--------
@ -12,7 +12,7 @@ LL | #[cfg(foo = "too")]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `bar`
--> $DIR/values-none.rs:16:7
--> $DIR/values-none.rs:15:7
|
LL | #[cfg(foo = "bar")]
| ^^^--------

View File

@ -1,7 +1,6 @@
//@ check-pass
//
//@ revisions: explicit implicit
//@ compile-flags: -Zunstable-options
//@ [explicit]compile-flags: --check-cfg=cfg(foo,values(none()))
//@ [implicit]compile-flags: --check-cfg=cfg(foo)
//@ [simple] compile-flags: --check-cfg=cfg(foo,values(none(),"too"))

View File

@ -2,7 +2,7 @@
//
//@ check-pass
//@ needs-llvm-components: x86
//@ compile-flags: --crate-type=lib --check-cfg=cfg() --target={{src-base}}/check-cfg/my-awesome-platform.json -Z unstable-options
//@ compile-flags: --crate-type=lib --check-cfg=cfg() --target={{src-base}}/check-cfg/my-awesome-platform.json
#![feature(lang_items, no_core, auto_traits)]
#![no_core]

View File

@ -1,7 +1,7 @@
// This test checks that we lint on non well known names and that we don't lint on well known names
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
#[cfg(target_oz = "linux")]
//~^ WARNING unexpected `cfg` condition name

View File

@ -5,7 +5,7 @@
// values since the suggestion shows them.
//
//@ check-pass
//@ compile-flags: --check-cfg=cfg() -Z unstable-options
//@ compile-flags: --check-cfg=cfg()
//@ compile-flags: -Zcheck-cfg-all-expected
#![feature(cfg_overflow_checks)]

View File

@ -1,3 +0,0 @@
//@ compile-flags: --check-cfg "cfg()"
fn main() {}

View File

@ -1,2 +0,0 @@
error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`