Skip to content

Commit 85e4765

Browse files
committed
Add specific test for check-cfg "and X more" diagnostic
1 parent ca4e54f commit 85e4765

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

Diff for: tests/ui/check-cfg/and-more-diagnostic.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This test makes sure that we don't emit a long list of possible values
2+
// but that we stop at a fix point and say "and X more".
3+
//
4+
//@ check-pass
5+
//@ no-auto-check-cfg
6+
//@ compile-flags: --check-cfg=cfg()
7+
//@ normalize-stderr-test: "and \d+ more" -> "and X more"
8+
//@ normalize-stderr-test: "`[a-zA-Z0-9_-]+`" -> "`xxx`"
9+
10+
fn main() {
11+
cfg!(target_feature = "zebra");
12+
//~^ WARNING unexpected `cfg` condition value
13+
}

Diff for: tests/ui/check-cfg/and-more-diagnostic.stderr

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
warning: unexpected `xxx` condition value: `xxx`
2+
--> $DIR/and-more-diagnostic.rs:11:10
3+
|
4+
LL | cfg!(target_feature = "zebra");
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: expected values for `xxx` are: `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, `xxx`, and `xxx` and X more
8+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
9+
= note: `#[warn(unexpected_cfgs)]` on by default
10+
11+
warning: 1 warning emitted
12+

Diff for: tests/ui/check-cfg/mix.rs

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ fn test_cfg_macro() {
7575
//~^ WARNING unexpected `cfg` condition value
7676
//~| WARNING unexpected `cfg` condition value
7777
//~| WARNING unexpected `cfg` condition value
78-
cfg!(target_feature = "zebra");
79-
//~^ WARNING unexpected `cfg` condition value
8078
}
8179

8280
fn main() {}

Diff for: tests/ui/check-cfg/mix.stderr

+1-10
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,5 @@ LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
245245
= help: to expect this configuration use `--check-cfg=cfg(feature, values("zebra"))`
246246
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
247247

248-
warning: unexpected `cfg` condition value: `zebra`
249-
--> $DIR/mix.rs:78:10
250-
|
251-
LL | cfg!(target_feature = "zebra");
252-
| ^^^^^^^^^^^^^^^^^^^^^^^^
253-
|
254-
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 252 more
255-
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
256-
257-
warning: 27 warnings emitted
248+
warning: 26 warnings emitted
258249

0 commit comments

Comments
 (0)