Skip to content

Commit 22b4c40

Browse files
authored
Rollup merge of rust-lang#95109 - Urgau:check-cfg-all-any, r=petrochenkov
Extend --check-cfg tests to all predicate inside all/any Now that rust-lang#94295 is merged it's time to add more tests to check that all predicate inside `all` and `any` are always checked. r? `@petrochenkov`
2 parents 7de48ea + a12674a commit 22b4c40

File tree

2 files changed

+117
-1
lines changed

2 files changed

+117
-1
lines changed

src/test/ui/check-cfg/mix.rs

+22
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ fn test_cfg_macro() {
4545
//~^ WARNING unexpected `cfg` condition name
4646
cfg!(any(feature = "bad", windows));
4747
//~^ WARNING unexpected `cfg` condition value
48+
cfg!(any(windows, xxx));
49+
//~^ WARNING unexpected `cfg` condition name
50+
cfg!(all(unix, xxx));
51+
//~^ WARNING unexpected `cfg` condition name
52+
cfg!(all(aa, bb));
53+
//~^ WARNING unexpected `cfg` condition name
54+
//~| WARNING unexpected `cfg` condition name
55+
cfg!(any(aa, bb));
56+
//~^ WARNING unexpected `cfg` condition name
57+
//~| WARNING unexpected `cfg` condition name
58+
cfg!(any(unix, feature = "zebra"));
59+
//~^ WARNING unexpected `cfg` condition value
60+
cfg!(any(xxx, feature = "zebra"));
61+
//~^ WARNING unexpected `cfg` condition name
62+
//~| WARNING unexpected `cfg` condition value
63+
cfg!(any(xxx, unix, xxx));
64+
//~^ WARNING unexpected `cfg` condition name
65+
//~| WARNING unexpected `cfg` condition name
66+
cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
67+
//~^ WARNING unexpected `cfg` condition value
68+
//~| WARNING unexpected `cfg` condition value
69+
//~| WARNING unexpected `cfg` condition value
4870
}
4971

5072
fn main() {}

src/test/ui/check-cfg/mix.stderr

+95-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,99 @@ LL | cfg!(any(feature = "bad", windows));
6262
|
6363
= note: expected values for `feature` are: bar, foo
6464

65-
warning: 9 warnings emitted
65+
warning: unexpected `cfg` condition name
66+
--> $DIR/mix.rs:48:23
67+
|
68+
LL | cfg!(any(windows, xxx));
69+
| ^^^
70+
71+
warning: unexpected `cfg` condition name
72+
--> $DIR/mix.rs:50:20
73+
|
74+
LL | cfg!(all(unix, xxx));
75+
| ^^^
76+
77+
warning: unexpected `cfg` condition name
78+
--> $DIR/mix.rs:52:14
79+
|
80+
LL | cfg!(all(aa, bb));
81+
| ^^
82+
83+
warning: unexpected `cfg` condition name
84+
--> $DIR/mix.rs:52:18
85+
|
86+
LL | cfg!(all(aa, bb));
87+
| ^^
88+
89+
warning: unexpected `cfg` condition name
90+
--> $DIR/mix.rs:55:14
91+
|
92+
LL | cfg!(any(aa, bb));
93+
| ^^
94+
95+
warning: unexpected `cfg` condition name
96+
--> $DIR/mix.rs:55:18
97+
|
98+
LL | cfg!(any(aa, bb));
99+
| ^^
100+
101+
warning: unexpected `cfg` condition value
102+
--> $DIR/mix.rs:58:20
103+
|
104+
LL | cfg!(any(unix, feature = "zebra"));
105+
| ^^^^^^^^^^^^^^^^^
106+
|
107+
= note: expected values for `feature` are: bar, foo
108+
109+
warning: unexpected `cfg` condition name
110+
--> $DIR/mix.rs:60:14
111+
|
112+
LL | cfg!(any(xxx, feature = "zebra"));
113+
| ^^^
114+
115+
warning: unexpected `cfg` condition value
116+
--> $DIR/mix.rs:60:19
117+
|
118+
LL | cfg!(any(xxx, feature = "zebra"));
119+
| ^^^^^^^^^^^^^^^^^
120+
|
121+
= note: expected values for `feature` are: bar, foo
122+
123+
warning: unexpected `cfg` condition name
124+
--> $DIR/mix.rs:63:14
125+
|
126+
LL | cfg!(any(xxx, unix, xxx));
127+
| ^^^
128+
129+
warning: unexpected `cfg` condition name
130+
--> $DIR/mix.rs:63:25
131+
|
132+
LL | cfg!(any(xxx, unix, xxx));
133+
| ^^^
134+
135+
warning: unexpected `cfg` condition value
136+
--> $DIR/mix.rs:66:14
137+
|
138+
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
139+
| ^^^^^^^^^^^^^^^^^
140+
|
141+
= note: expected values for `feature` are: bar, foo
142+
143+
warning: unexpected `cfg` condition value
144+
--> $DIR/mix.rs:66:33
145+
|
146+
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
147+
| ^^^^^^^^^^^^^^^^^
148+
|
149+
= note: expected values for `feature` are: bar, foo
150+
151+
warning: unexpected `cfg` condition value
152+
--> $DIR/mix.rs:66:52
153+
|
154+
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
155+
| ^^^^^^^^^^^^^^^^^
156+
|
157+
= note: expected values for `feature` are: bar, foo
158+
159+
warning: 23 warnings emitted
66160

0 commit comments

Comments
 (0)