Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7c9b2f1

Browse files
committedDec 7, 2023
Add more suggestion to unexpected cfg names and values
1 parent 568f6a8 commit 7c9b2f1

37 files changed

+449
-326
lines changed
 

‎compiler/rustc_lint/src/context.rs

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,13 @@ pub trait LintContext {
706706
},
707707
BuiltinLintDiagnostics::UnexpectedCfgName((name, name_span), value) => {
708708
let possibilities: Vec<Symbol> = sess.parse_sess.check_config.expecteds.keys().copied().collect();
709+
let is_from_cargo = std::env::var_os("CARGO").is_some();
710+
let mut is_feature_cfg = name == sym::feature;
709711

712+
if is_feature_cfg && is_from_cargo {
713+
db.help("consider defining some features in `Cargo.toml`");
710714
// Suggest the most probable if we found one
711-
if let Some(best_match) = find_best_match_for_name(&possibilities, name, None) {
715+
} else if let Some(best_match) = find_best_match_for_name(&possibilities, name, None) {
712716
if let Some(ExpectedValues::Some(best_match_values)) =
713717
sess.parse_sess.check_config.expecteds.get(&best_match) {
714718
let mut possibilities = best_match_values.iter()
@@ -741,8 +745,8 @@ pub trait LintContext {
741745
} else {
742746
db.span_suggestion(name_span, "there is a config with a similar name", best_match, Applicability::MaybeIncorrect);
743747
}
744-
} else if name == sym::feature && std::env::var_os("CARGO").is_some() {
745-
db.help("consider defining some features in `Cargo.toml`");
748+
749+
is_feature_cfg |= best_match == sym::feature;
746750
} else if !possibilities.is_empty() {
747751
let mut possibilities = possibilities.iter()
748752
.map(Symbol::as_str)
@@ -756,6 +760,23 @@ pub trait LintContext {
756760
// once.
757761
db.help_once(format!("expected names are: `{possibilities}`"));
758762
}
763+
764+
let inst = if let Some((value, _value_span)) = value {
765+
let pre = if is_from_cargo { "\\" } else { "" };
766+
format!("cfg({name}, values({pre}\"{value}{pre}\"))")
767+
} else {
768+
format!("cfg({name})")
769+
};
770+
771+
if is_from_cargo {
772+
if !is_feature_cfg {
773+
db.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`"));
774+
}
775+
db.note("see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration");
776+
} else {
777+
db.help(format!("to expect this configuration use `--check-cfg={inst}`"));
778+
db.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
779+
}
759780
},
760781
BuiltinLintDiagnostics::UnexpectedCfgValue((name, name_span), value) => {
761782
let Some(ExpectedValues::Some(values)) = &sess.parse_sess.check_config.expecteds.get(&name) else {
@@ -767,6 +788,7 @@ pub trait LintContext {
767788
.copied()
768789
.flatten()
769790
.collect();
791+
let is_from_cargo = std::env::var_os("CARGO").is_some();
770792

771793
// Show the full list if all possible values for a given name, but don't do it
772794
// for names as the possibilities could be very long
@@ -787,6 +809,8 @@ pub trait LintContext {
787809
db.span_suggestion(value_span, "there is a expected value with a similar name", format!("\"{best_match}\""), Applicability::MaybeIncorrect);
788810

789811
}
812+
} else if name == sym::feature && is_from_cargo {
813+
db.help(format!("consider defining `{name}` as feature in `Cargo.toml`"));
790814
} else if let &[first_possibility] = &possibilities[..] {
791815
db.span_suggestion(name_span.shrink_to_hi(), "specify a config value", format!(" = \"{first_possibility}\""), Applicability::MaybeIncorrect);
792816
}
@@ -796,6 +820,61 @@ pub trait LintContext {
796820
db.span_suggestion(name_span.shrink_to_hi().to(value_span), "remove the value", "", Applicability::MaybeIncorrect);
797821
}
798822
}
823+
824+
// We don't want to suggest adding values to well known names
825+
// since those are defined by rustc it-self. Users can still
826+
// do it if they want, but should not encourage them.
827+
const WELL_KNOWN_NAMES: &'static [Symbol] = &[
828+
sym::doc,
829+
sym::miri,
830+
sym::unix,
831+
sym::test,
832+
sym::doctest,
833+
sym::windows,
834+
sym::proc_macro,
835+
sym::panic,
836+
sym::sanitize,
837+
sym::relocation_model,
838+
sym::debug_assertions,
839+
sym::overflow_checks,
840+
sym::target_thread_local,
841+
sym::target_feature,
842+
sym::target_os,
843+
sym::target_family,
844+
sym::target_arch,
845+
sym::target_endian,
846+
sym::target_env,
847+
sym::target_abi,
848+
sym::target_vendor,
849+
sym::target_pointer_width,
850+
sym::target_has_atomic,
851+
sym::target_has_atomic_load_store,
852+
sym::target_has_atomic_equal_alignment,
853+
];
854+
855+
let is_cfg_a_well_know_name = WELL_KNOWN_NAMES.contains(&name);
856+
let inst = if let Some((value, _value_span)) = value {
857+
let pre = if is_from_cargo { "\\" } else { "" };
858+
format!("cfg({name}, values({pre}\"{value}{pre}\"))")
859+
} else {
860+
format!("cfg({name})")
861+
};
862+
863+
if is_from_cargo {
864+
if name == sym::feature {
865+
if let Some((value, _value_span)) = value {
866+
db.help(format!("consider adding `{value}` as a feature in `Cargo.toml`"));
867+
}
868+
} else if !is_cfg_a_well_know_name {
869+
db.help(format!("consider using a Cargo feature instead or adding `println!(\"cargo:rustc-check-cfg={inst}\");` to the top of a `build.rs`"));
870+
}
871+
db.note("see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration");
872+
} else {
873+
if !is_cfg_a_well_know_name {
874+
db.help(format!("to expect this configuration use `--check-cfg={inst}`"));
875+
}
876+
db.note("see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration");
877+
}
799878
},
800879
BuiltinLintDiagnostics::DeprecatedWhereclauseLocation(new_span, suggestion) => {
801880
db.multipart_suggestion(

‎tests/rustdoc-ui/check-cfg/check-cfg.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: unexpected `cfg` condition name: `uniz`
44
LL | #[cfg(uniz)]
55
| ^^^^ help: there is a config with a similar name: `unix`
66
|
7+
= help: to expect this configuration use `--check-cfg=cfg(uniz)`
8+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
79
= note: `#[warn(unexpected_cfgs)]` on by default
810

911
warning: 1 warning emitted

‎tests/rustdoc-ui/doctest/check-cfg-test.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(feature = "invalid")]
55
| ^^^^^^^^^^^^^^^^^^^
66
|
77
= note: expected values for `feature` are: `test`
8+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("invalid"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/allow-same-level.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(FALSE)]
55
| ^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
warning: unexpected `cfg` condition name: `feature`
2+
--> $DIR/cargo-feature.rs:13:7
3+
|
4+
LL | #[cfg(feature = "serde")]
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= help: consider defining some features in `Cargo.toml`
8+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
9+
= note: `#[warn(unexpected_cfgs)]` on by default
10+
11+
warning: unexpected `cfg` condition name: `tokio_unstable`
12+
--> $DIR/cargo-feature.rs:18:7
13+
|
14+
LL | #[cfg(tokio_unstable)]
15+
| ^^^^^^^^^^^^^^
16+
|
17+
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
18+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs`
19+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
20+
21+
warning: unexpected `cfg` condition name: `CONFIG_NVME`
22+
--> $DIR/cargo-feature.rs:22:7
23+
|
24+
LL | #[cfg(CONFIG_NVME = "m")]
25+
| ^^^^^^^^^^^^^^^^^
26+
|
27+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs`
28+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
29+
30+
warning: 3 warnings emitted
31+

‎tests/ui/check-cfg/cargo-feature.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@
33
// list of all the expected names
44
//
55
// check-pass
6+
// revisions: some none
67
// rustc-env:CARGO=/usr/bin/cargo
78
// compile-flags: --check-cfg=cfg() -Z unstable-options
8-
// error-pattern:Cargo.toml
9+
// [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
10+
// [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))
11+
// [none]error-pattern:Cargo.toml
912

1013
#[cfg(feature = "serde")]
11-
//~^ WARNING unexpected `cfg` condition name
14+
//[none]~^ WARNING unexpected `cfg` condition name
15+
//[some]~^^ WARNING unexpected `cfg` condition value
1216
fn ser() {}
1317

18+
#[cfg(tokio_unstable)]
19+
//~^ WARNING unexpected `cfg` condition name
20+
fn tokio() {}
21+
22+
#[cfg(CONFIG_NVME = "m")]
23+
//[none]~^ WARNING unexpected `cfg` condition name
24+
//[some]~^^ WARNING unexpected `cfg` condition value
25+
fn tokio() {}
26+
1427
fn main() {}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
warning: unexpected `cfg` condition value: `serde`
2+
--> $DIR/cargo-feature.rs:13:7
3+
|
4+
LL | #[cfg(feature = "serde")]
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: expected values for `feature` are: `bitcode`
8+
= help: consider adding `serde` as a feature in `Cargo.toml`
9+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
10+
= note: `#[warn(unexpected_cfgs)]` on by default
11+
12+
warning: unexpected `cfg` condition name: `tokio_unstable`
13+
--> $DIR/cargo-feature.rs:18:7
14+
|
15+
LL | #[cfg(tokio_unstable)]
16+
| ^^^^^^^^^^^^^^
17+
|
18+
= help: expected names are: `CONFIG_NVME`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
19+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs`
20+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
21+
22+
warning: unexpected `cfg` condition value: `m`
23+
--> $DIR/cargo-feature.rs:22:7
24+
|
25+
LL | #[cfg(CONFIG_NVME = "m")]
26+
| ^^^^^^^^^^^^^^---
27+
| |
28+
| help: there is a expected value with a similar name: `"y"`
29+
|
30+
= note: expected values for `CONFIG_NVME` are: `y`
31+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs`
32+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
33+
34+
warning: 3 warnings emitted
35+

‎tests/ui/check-cfg/cargo-feature.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎tests/ui/check-cfg/compact-names.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(target(os = "linux", architecture = "arm"))]
55
| ^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/compact-values.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LL | #[cfg(target(os = "linux", arch = "X"))]
55
| ^^^^^^^^^^
66
|
77
= note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
8+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
89
= note: `#[warn(unexpected_cfgs)]` on by default
910

1011
warning: 1 warning emitted

‎tests/ui/check-cfg/concat-values.stderr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(my_cfg)]
55
| ^^^^^^
66
|
77
= note: expected values for `my_cfg` are: `bar`, `foo`
8+
= help: to expect this configuration use `--check-cfg=cfg(my_cfg)`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: unexpected `cfg` condition value: `unk`
@@ -14,6 +16,8 @@ LL | #[cfg(my_cfg = "unk")]
1416
| ^^^^^^^^^^^^^^
1517
|
1618
= note: expected values for `my_cfg` are: `bar`, `foo`
19+
= help: to expect this configuration use `--check-cfg=cfg(my_cfg, values("unk"))`
20+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1721

1822
warning: 2 warnings emitted
1923

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
warning: unexpected `cfg` condition name: `featur`
2+
--> $DIR/diagnotics.rs:7:7
3+
|
4+
LL | #[cfg(featur)]
5+
| ^^^^^^ help: there is a config with a similar name: `feature`
6+
|
7+
= help: expected values for `feature` are: `foo`
8+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
9+
= note: `#[warn(unexpected_cfgs)]` on by default
10+
11+
warning: unexpected `cfg` condition name: `featur`
12+
--> $DIR/diagnotics.rs:11:7
13+
|
14+
LL | #[cfg(featur = "foo")]
15+
| ^^^^^^^^^^^^^^
16+
|
17+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
18+
help: there is a config with a similar name and value
19+
|
20+
LL | #[cfg(feature = "foo")]
21+
| ~~~~~~~
22+
23+
warning: unexpected `cfg` condition name: `featur`
24+
--> $DIR/diagnotics.rs:15:7
25+
|
26+
LL | #[cfg(featur = "fo")]
27+
| ^^^^^^^^^^^^^
28+
|
29+
= help: expected values for `feature` are: `foo`
30+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
31+
help: there is a config with a similar name and different values
32+
|
33+
LL | #[cfg(feature = "foo")]
34+
| ~~~~~~~~~~~~~~~
35+
36+
warning: unexpected `cfg` condition name: `no_value`
37+
--> $DIR/diagnotics.rs:22:7
38+
|
39+
LL | #[cfg(no_value)]
40+
| ^^^^^^^^ help: there is a config with a similar name: `no_values`
41+
|
42+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value)");` to the top of a `build.rs`
43+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
44+
45+
warning: unexpected `cfg` condition name: `no_value`
46+
--> $DIR/diagnotics.rs:26:7
47+
|
48+
LL | #[cfg(no_value = "foo")]
49+
| ^^^^^^^^^^^^^^^^
50+
|
51+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_value, values(\"foo\"))");` to the top of a `build.rs`
52+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
53+
help: there is a config with a similar name and no value
54+
|
55+
LL | #[cfg(no_values)]
56+
| ~~~~~~~~~
57+
58+
warning: unexpected `cfg` condition value: `bar`
59+
--> $DIR/diagnotics.rs:30:7
60+
|
61+
LL | #[cfg(no_values = "bar")]
62+
| ^^^^^^^^^--------
63+
| |
64+
| help: remove the value
65+
|
66+
= note: no expected value for `no_values`
67+
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(no_values, values(\"bar\"))");` to the top of a `build.rs`
68+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
69+
70+
warning: 6 warnings emitted
71+

‎tests/ui/check-cfg/diagnotics.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// check-pass
2+
// revisions: cargo rustc
3+
// [rustc]unset-rustc-env:CARGO
4+
// [cargo]rustc-env:CARGO=/usr/bin/cargo
25
// compile-flags: --check-cfg=cfg(feature,values("foo")) --check-cfg=cfg(no_values) -Z unstable-options
36

47
#[cfg(featur)]
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
warning: unexpected `cfg` condition name: `featur`
2+
--> $DIR/diagnotics.rs:7:7
3+
|
4+
LL | #[cfg(featur)]
5+
| ^^^^^^ help: there is a config with a similar name: `feature`
6+
|
7+
= help: expected values for `feature` are: `foo`
8+
= help: to expect this configuration use `--check-cfg=cfg(featur)`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
10+
= note: `#[warn(unexpected_cfgs)]` on by default
11+
12+
warning: unexpected `cfg` condition name: `featur`
13+
--> $DIR/diagnotics.rs:11:7
14+
|
15+
LL | #[cfg(featur = "foo")]
16+
| ^^^^^^^^^^^^^^
17+
|
18+
= help: to expect this configuration use `--check-cfg=cfg(featur, values("foo"))`
19+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
20+
help: there is a config with a similar name and value
21+
|
22+
LL | #[cfg(feature = "foo")]
23+
| ~~~~~~~
24+
25+
warning: unexpected `cfg` condition name: `featur`
26+
--> $DIR/diagnotics.rs:15:7
27+
|
28+
LL | #[cfg(featur = "fo")]
29+
| ^^^^^^^^^^^^^
30+
|
31+
= help: expected values for `feature` are: `foo`
32+
= help: to expect this configuration use `--check-cfg=cfg(featur, values("fo"))`
33+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
34+
help: there is a config with a similar name and different values
35+
|
36+
LL | #[cfg(feature = "foo")]
37+
| ~~~~~~~~~~~~~~~
38+
39+
warning: unexpected `cfg` condition name: `no_value`
40+
--> $DIR/diagnotics.rs:22:7
41+
|
42+
LL | #[cfg(no_value)]
43+
| ^^^^^^^^ help: there is a config with a similar name: `no_values`
44+
|
45+
= help: to expect this configuration use `--check-cfg=cfg(no_value)`
46+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
47+
48+
warning: unexpected `cfg` condition name: `no_value`
49+
--> $DIR/diagnotics.rs:26:7
50+
|
51+
LL | #[cfg(no_value = "foo")]
52+
| ^^^^^^^^^^^^^^^^
53+
|
54+
= help: to expect this configuration use `--check-cfg=cfg(no_value, values("foo"))`
55+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
56+
help: there is a config with a similar name and no value
57+
|
58+
LL | #[cfg(no_values)]
59+
| ~~~~~~~~~
60+
61+
warning: unexpected `cfg` condition value: `bar`
62+
--> $DIR/diagnotics.rs:30:7
63+
|
64+
LL | #[cfg(no_values = "bar")]
65+
| ^^^^^^^^^--------
66+
| |
67+
| help: remove the value
68+
|
69+
= note: no expected value for `no_values`
70+
= help: to expect this configuration use `--check-cfg=cfg(no_values, values("bar"))`
71+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
72+
73+
warning: 6 warnings emitted
74+

‎tests/ui/check-cfg/diagnotics.stderr

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: unexpected `cfg` condition value: `value`
@@ -16,18 +18,25 @@ LL | #[cfg(test = "value")]
1618
| help: remove the value
1719
|
1820
= note: no expected value for `test`
21+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1922

2023
warning: unexpected `cfg` condition name: `feature`
2124
--> $DIR/exhaustive-names-values.rs:18:7
2225
|
2326
LL | #[cfg(feature = "unk")]
2427
| ^^^^^^^^^^^^^^^
28+
|
29+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("unk"))`
30+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2531

2632
warning: unexpected `cfg` condition name: `feature`
2733
--> $DIR/exhaustive-names-values.rs:25:7
2834
|
2935
LL | #[cfg(feature = "std")]
3036
| ^^^^^^^^^^^^^^^
37+
|
38+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("std"))`
39+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
3140

3241
warning: 4 warnings emitted
3342

‎tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎tests/ui/check-cfg/exhaustive-names-values.feature.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: unexpected `cfg` condition value: `value`
@@ -16,6 +18,7 @@ LL | #[cfg(test = "value")]
1618
| help: remove the value
1719
|
1820
= note: no expected value for `test`
21+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1922

2023
warning: unexpected `cfg` condition value: `unk`
2124
--> $DIR/exhaustive-names-values.rs:18:7
@@ -24,6 +27,8 @@ LL | #[cfg(feature = "unk")]
2427
| ^^^^^^^^^^^^^^^
2528
|
2629
= note: expected values for `feature` are: `std`
30+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("unk"))`
31+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2732

2833
warning: 3 warnings emitted
2934

‎tests/ui/check-cfg/exhaustive-names-values.full.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: unexpected `cfg` condition value: `value`
@@ -16,6 +18,7 @@ LL | #[cfg(test = "value")]
1618
| help: remove the value
1719
|
1820
= note: no expected value for `test`
21+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1922

2023
warning: unexpected `cfg` condition value: `unk`
2124
--> $DIR/exhaustive-names-values.rs:18:7
@@ -24,6 +27,8 @@ LL | #[cfg(feature = "unk")]
2427
| ^^^^^^^^^^^^^^^
2528
|
2629
= note: expected values for `feature` are: `std`
30+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("unk"))`
31+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2732

2833
warning: 3 warnings emitted
2934

‎tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎tests/ui/check-cfg/exhaustive-names.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/exhaustive-values.empty_cfg.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | #[cfg(test = "value")]
77
| help: remove the value
88
|
99
= note: no expected value for `test`
10+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1011
= note: `#[warn(unexpected_cfgs)]` on by default
1112

1213
warning: 1 warning emitted

‎tests/ui/check-cfg/exhaustive-values.without_names.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | #[cfg(test = "value")]
77
| help: remove the value
88
|
99
= note: no expected value for `test`
10+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1011
= note: `#[warn(unexpected_cfgs)]` on by default
1112

1213
warning: 1 warning emitted

‎tests/ui/check-cfg/mix.cfg.stderr

Lines changed: 0 additions & 184 deletions
This file was deleted.

‎tests/ui/check-cfg/mix.stderr

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: unexpected `cfg` condition name: `widnows`
44
LL | #[cfg(widnows)]
55
| ^^^^^^^ help: there is a config with a similar name: `windows`
66
|
7+
= help: to expect this configuration use `--check-cfg=cfg(widnows)`
8+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
79
= note: `#[warn(unexpected_cfgs)]` on by default
810

911
warning: unexpected `cfg` condition value: (none)
@@ -13,6 +15,8 @@ LL | #[cfg(feature)]
1315
| ^^^^^^^- help: specify a config value: `= "foo"`
1416
|
1517
= note: expected values for `feature` are: `foo`
18+
= help: to expect this configuration use `--check-cfg=cfg(feature)`
19+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1620

1721
warning: unexpected `cfg` condition value: `bar`
1822
--> $DIR/mix.rs:23:7
@@ -21,6 +25,8 @@ LL | #[cfg(feature = "bar")]
2125
| ^^^^^^^^^^^^^^^
2226
|
2327
= note: expected values for `feature` are: `foo`
28+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("bar"))`
29+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2430

2531
warning: unexpected `cfg` condition value: `zebra`
2632
--> $DIR/mix.rs:27:7
@@ -29,6 +35,8 @@ LL | #[cfg(feature = "zebra")]
2935
| ^^^^^^^^^^^^^^^^^
3036
|
3137
= note: expected values for `feature` are: `foo`
38+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
39+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
3240

3341
warning: unexpected `cfg` condition name: `uu`
3442
--> $DIR/mix.rs:31:12
@@ -37,12 +45,17 @@ LL | #[cfg_attr(uu, test)]
3745
| ^^
3846
|
3947
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
48+
= help: to expect this configuration use `--check-cfg=cfg(uu)`
49+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
4050

4151
warning: unexpected `cfg` condition name: `widnows`
4252
--> $DIR/mix.rs:40:10
4353
|
4454
LL | cfg!(widnows);
4555
| ^^^^^^^ help: there is a config with a similar name: `windows`
56+
|
57+
= help: to expect this configuration use `--check-cfg=cfg(widnows)`
58+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
4659

4760
warning: unexpected `cfg` condition value: `bar`
4861
--> $DIR/mix.rs:43:10
@@ -51,6 +64,8 @@ LL | cfg!(feature = "bar");
5164
| ^^^^^^^^^^^^^^^
5265
|
5366
= note: expected values for `feature` are: `foo`
67+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("bar"))`
68+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
5469

5570
warning: unexpected `cfg` condition value: `zebra`
5671
--> $DIR/mix.rs:45:10
@@ -59,24 +74,35 @@ LL | cfg!(feature = "zebra");
5974
| ^^^^^^^^^^^^^^^^^
6075
|
6176
= note: expected values for `feature` are: `foo`
77+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
78+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
6279

6380
warning: unexpected `cfg` condition name: `xxx`
6481
--> $DIR/mix.rs:47:10
6582
|
6683
LL | cfg!(xxx = "foo");
6784
| ^^^^^^^^^^^
85+
|
86+
= help: to expect this configuration use `--check-cfg=cfg(xxx, values("foo"))`
87+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
6888

6989
warning: unexpected `cfg` condition name: `xxx`
7090
--> $DIR/mix.rs:49:10
7191
|
7292
LL | cfg!(xxx);
7393
| ^^^
94+
|
95+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
96+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
7497

7598
warning: unexpected `cfg` condition name: `xxx`
7699
--> $DIR/mix.rs:51:14
77100
|
78101
LL | cfg!(any(xxx, windows));
79102
| ^^^
103+
|
104+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
105+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
80106

81107
warning: unexpected `cfg` condition value: `bad`
82108
--> $DIR/mix.rs:53:14
@@ -85,42 +111,62 @@ LL | cfg!(any(feature = "bad", windows));
85111
| ^^^^^^^^^^^^^^^
86112
|
87113
= note: expected values for `feature` are: `foo`
114+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("bad"))`
115+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
88116

89117
warning: unexpected `cfg` condition name: `xxx`
90118
--> $DIR/mix.rs:55:23
91119
|
92120
LL | cfg!(any(windows, xxx));
93121
| ^^^
122+
|
123+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
124+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
94125

95126
warning: unexpected `cfg` condition name: `xxx`
96127
--> $DIR/mix.rs:57:20
97128
|
98129
LL | cfg!(all(unix, xxx));
99130
| ^^^
131+
|
132+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
133+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
100134

101135
warning: unexpected `cfg` condition name: `aa`
102136
--> $DIR/mix.rs:59:14
103137
|
104138
LL | cfg!(all(aa, bb));
105139
| ^^
140+
|
141+
= help: to expect this configuration use `--check-cfg=cfg(aa)`
142+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
106143

107144
warning: unexpected `cfg` condition name: `bb`
108145
--> $DIR/mix.rs:59:18
109146
|
110147
LL | cfg!(all(aa, bb));
111148
| ^^
149+
|
150+
= help: to expect this configuration use `--check-cfg=cfg(bb)`
151+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
112152

113153
warning: unexpected `cfg` condition name: `aa`
114154
--> $DIR/mix.rs:62:14
115155
|
116156
LL | cfg!(any(aa, bb));
117157
| ^^
158+
|
159+
= help: to expect this configuration use `--check-cfg=cfg(aa)`
160+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
118161

119162
warning: unexpected `cfg` condition name: `bb`
120163
--> $DIR/mix.rs:62:18
121164
|
122165
LL | cfg!(any(aa, bb));
123166
| ^^
167+
|
168+
= help: to expect this configuration use `--check-cfg=cfg(bb)`
169+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
124170

125171
warning: unexpected `cfg` condition value: `zebra`
126172
--> $DIR/mix.rs:65:20
@@ -129,12 +175,17 @@ LL | cfg!(any(unix, feature = "zebra"));
129175
| ^^^^^^^^^^^^^^^^^
130176
|
131177
= note: expected values for `feature` are: `foo`
178+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
179+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
132180

133181
warning: unexpected `cfg` condition name: `xxx`
134182
--> $DIR/mix.rs:67:14
135183
|
136184
LL | cfg!(any(xxx, feature = "zebra"));
137185
| ^^^
186+
|
187+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
188+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
138189

139190
warning: unexpected `cfg` condition value: `zebra`
140191
--> $DIR/mix.rs:67:19
@@ -143,18 +194,26 @@ LL | cfg!(any(xxx, feature = "zebra"));
143194
| ^^^^^^^^^^^^^^^^^
144195
|
145196
= note: expected values for `feature` are: `foo`
197+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
198+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
146199

147200
warning: unexpected `cfg` condition name: `xxx`
148201
--> $DIR/mix.rs:70:14
149202
|
150203
LL | cfg!(any(xxx, unix, xxx));
151204
| ^^^
205+
|
206+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
207+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
152208

153209
warning: unexpected `cfg` condition name: `xxx`
154210
--> $DIR/mix.rs:70:25
155211
|
156212
LL | cfg!(any(xxx, unix, xxx));
157213
| ^^^
214+
|
215+
= help: to expect this configuration use `--check-cfg=cfg(xxx)`
216+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
158217

159218
warning: unexpected `cfg` condition value: `zebra`
160219
--> $DIR/mix.rs:73:14
@@ -163,6 +222,8 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
163222
| ^^^^^^^^^^^^^^^^^
164223
|
165224
= note: expected values for `feature` are: `foo`
225+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
226+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
166227

167228
warning: unexpected `cfg` condition value: `zebra`
168229
--> $DIR/mix.rs:73:33
@@ -171,6 +232,8 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
171232
| ^^^^^^^^^^^^^^^^^
172233
|
173234
= note: expected values for `feature` are: `foo`
235+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
236+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
174237

175238
warning: unexpected `cfg` condition value: `zebra`
176239
--> $DIR/mix.rs:73:52
@@ -179,6 +242,8 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
179242
| ^^^^^^^^^^^^^^^^^
180243
|
181244
= note: expected values for `feature` are: `foo`
245+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
246+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
182247

183248
warning: 26 warnings emitted
184249

‎tests/ui/check-cfg/no-expected-values.empty.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | #[cfg(feature = "foo")]
77
| help: remove the value
88
|
99
= note: no expected value for `feature`
10+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))`
11+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1012
= note: `#[warn(unexpected_cfgs)]` on by default
1113

1214
warning: unexpected `cfg` condition value: `foo`
@@ -18,6 +20,7 @@ LL | #[cfg(test = "foo")]
1820
| help: remove the value
1921
|
2022
= note: no expected value for `test`
23+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2124

2225
warning: 2 warnings emitted
2326

‎tests/ui/check-cfg/no-expected-values.mixed.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | #[cfg(feature = "foo")]
77
| help: remove the value
88
|
99
= note: no expected value for `feature`
10+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))`
11+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1012
= note: `#[warn(unexpected_cfgs)]` on by default
1113

1214
warning: unexpected `cfg` condition value: `foo`
@@ -18,6 +20,7 @@ LL | #[cfg(test = "foo")]
1820
| help: remove the value
1921
|
2022
= note: no expected value for `test`
23+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2124

2225
warning: 2 warnings emitted
2326

‎tests/ui/check-cfg/no-expected-values.simple.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | #[cfg(feature = "foo")]
77
| help: remove the value
88
|
99
= note: no expected value for `feature`
10+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))`
11+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1012
= note: `#[warn(unexpected_cfgs)]` on by default
1113

1214
warning: unexpected `cfg` condition value: `foo`
@@ -18,6 +20,7 @@ LL | #[cfg(test = "foo")]
1820
| help: remove the value
1921
|
2022
= note: no expected value for `test`
23+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2124

2225
warning: 2 warnings emitted
2326

‎tests/ui/check-cfg/order-independant.values_after.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(a = "unk")]
55
| ^^^^^^^^^
66
|
77
= note: expected values for `a` are: (none), `b`
8+
= help: to expect this configuration use `--check-cfg=cfg(a, values("unk"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/order-independant.values_before.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(a = "unk")]
55
| ^^^^^^^^^
66
|
77
= note: expected values for `a` are: (none), `b`
8+
= help: to expect this configuration use `--check-cfg=cfg(a, values("unk"))`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/stmt-no-ice.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LL | #[cfg(crossbeam_loom)]
55
| ^^^^^^^^^^^^^^
66
|
77
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
8+
= help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)`
9+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
810
= note: `#[warn(unexpected_cfgs)]` on by default
911

1012
warning: 1 warning emitted

‎tests/ui/check-cfg/unexpected-cfg-name.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: unexpected `cfg` condition name: `widnows`
44
LL | #[cfg(widnows)]
55
| ^^^^^^^ help: there is a config with a similar name: `windows`
66
|
7+
= help: to expect this configuration use `--check-cfg=cfg(widnows)`
8+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
79
= note: `#[warn(unexpected_cfgs)]` on by default
810

911
warning: 1 warning emitted

‎tests/ui/check-cfg/unexpected-cfg-value.cfg.stderr

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎tests/ui/check-cfg/unexpected-cfg-value.stderr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LL | #[cfg(feature = "sedre")]
77
| help: there is a expected value with a similar name: `"serde"`
88
|
99
= note: expected values for `feature` are: `full`, `serde`
10+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("sedre"))`
11+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1012
= note: `#[warn(unexpected_cfgs)]` on by default
1113

1214
warning: unexpected `cfg` condition value: `rand`
@@ -16,6 +18,8 @@ LL | #[cfg(feature = "rand")]
1618
| ^^^^^^^^^^^^^^^^
1719
|
1820
= note: expected values for `feature` are: `full`, `serde`
21+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("rand"))`
22+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1923

2024
warning: 2 warnings emitted
2125

‎tests/ui/check-cfg/values-target-json.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | #[cfg(target_os = "linuz")]
77
| help: there is a expected value with a similar name: `"linux"`
88
|
99
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `ericos`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
10+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1011
= note: `#[warn(unexpected_cfgs)]` on by default
1112

1213
warning: 1 warning emitted

‎tests/ui/check-cfg/well-known-names.stderr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ warning: unexpected `cfg` condition name: `target_oz`
44
LL | #[cfg(target_oz = "linux")]
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7+
= help: to expect this configuration use `--check-cfg=cfg(target_oz, values("linux"))`
8+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
79
= note: `#[warn(unexpected_cfgs)]` on by default
810
help: there is a config with a similar name and value
911
|
@@ -17,18 +19,26 @@ LL | #[cfg(features = "foo")]
1719
| ^^^^^^^^^^^^^^^^
1820
|
1921
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows`
22+
= help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))`
23+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2024

2125
warning: unexpected `cfg` condition name: `feature`
2226
--> $DIR/well-known-names.rs:17:7
2327
|
2428
LL | #[cfg(feature = "foo")]
2529
| ^^^^^^^^^^^^^^^
30+
|
31+
= help: to expect this configuration use `--check-cfg=cfg(feature, values("foo"))`
32+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2633

2734
warning: unexpected `cfg` condition name: `uniw`
2835
--> $DIR/well-known-names.rs:21:7
2936
|
3037
LL | #[cfg(uniw)]
3138
| ^^^^ help: there is a config with a similar name: `unix`
39+
|
40+
= help: to expect this configuration use `--check-cfg=cfg(uniw)`
41+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
3242

3343
warning: 4 warnings emitted
3444

‎tests/ui/check-cfg/well-known-values.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | #[cfg(target_os = "linuz")]
77
| help: there is a expected value with a similar name: `"linux"`
88
|
99
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`
10+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
1011
= note: `#[warn(unexpected_cfgs)]` on by default
1112

1213
warning: unexpected `cfg` condition value: `0`
@@ -18,6 +19,7 @@ LL | #[cfg(target_has_atomic = "0")]
1819
| help: there is a expected value with a similar name: `"8"`
1920
|
2021
= note: expected values for `target_has_atomic` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
22+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
2123

2224
warning: unexpected `cfg` condition value: `aa`
2325
--> $DIR/well-known-values.rs:21:7
@@ -28,6 +30,7 @@ LL | #[cfg(unix = "aa")]
2830
| help: remove the value
2931
|
3032
= note: no expected value for `unix`
33+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
3134

3235
warning: unexpected `cfg` condition value: `miri`
3336
--> $DIR/well-known-values.rs:28:7
@@ -38,6 +41,7 @@ LL | #[cfg(miri = "miri")]
3841
| help: remove the value
3942
|
4043
= note: no expected value for `miri`
44+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
4145

4246
warning: unexpected `cfg` condition value: `linux`
4347
--> $DIR/well-known-values.rs:35:7
@@ -48,6 +52,7 @@ LL | #[cfg(doc = "linux")]
4852
| help: remove the value
4953
|
5054
= note: no expected value for `doc`
55+
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
5156

5257
warning: 5 warnings emitted
5358

0 commit comments

Comments
 (0)
Please sign in to comment.