Stabilize checking of cfgs at compile-time: --check-cfg option
This commit is contained in:
parent
99d0186b1d
commit
909fcfcb6a
@ -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",
|
||||
"",
|
||||
|
@ -60,12 +60,9 @@ 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 lib_str in &options.lib_strs {
|
||||
content.push(format!("-L{lib_str}"));
|
||||
|
@ -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(
|
||||
|
@ -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)]
|
@ -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
|
||||
|
@ -1,2 +0,0 @@
|
||||
//@ check-fail
|
||||
//@ compile-flags: --check-cfg=cfg()
|
@ -1,2 +0,0 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -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"))
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^---
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
| ^^^^^
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
| ^^^^^^^^
|
||||
|
@ -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)]
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)]
|
||||
|
@ -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")]
|
||||
| ^^^^--------
|
||||
|
@ -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")]
|
||||
| ^^^^--------
|
||||
|
@ -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)
|
||||
|
@ -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")]
|
||||
| ^^^^--------
|
||||
|
@ -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"))
|
||||
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^
|
||||
|
@ -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")]
|
||||
| ^^^^^^^^^
|
||||
|
@ -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)]
|
||||
|
@ -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
|
||||
|
@ -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")]
|
||||
|
@ -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()))
|
||||
|
@ -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")]
|
||||
| ^^^--------
|
||||
|
@ -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")]
|
||||
| ^^^--------
|
||||
|
@ -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"))
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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)]
|
||||
|
@ -1,3 +0,0 @@
|
||||
//@ compile-flags: --check-cfg "cfg()"
|
||||
|
||||
fn main() {}
|
@ -1,2 +0,0 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`
|
||||
|
Loading…
Reference in New Issue
Block a user