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 623e99e

Browse files
committedNov 22, 2023
Remove deprecated --check-cfg names() and values() syntax
1 parent 347e382 commit 623e99e

35 files changed

+173
-397
lines changed
 

‎compiler/rustc_interface/src/interface.rs

Lines changed: 83 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_data_structures::sync::Lrc;
1010
use rustc_errors::registry::Registry;
1111
use rustc_errors::{ErrorGuaranteed, Handler};
1212
use rustc_lint::LintStore;
13+
use rustc_middle::ty;
1314
use rustc_middle::util::Providers;
14-
use rustc_middle::{bug, ty};
1515
use rustc_parse::maybe_new_parser_from_source_str;
1616
use rustc_query_impl::QueryCtxt;
1717
use rustc_query_system::query::print_query_stack;
@@ -122,7 +122,6 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
122122
let exhaustive_values = !specs.is_empty();
123123
let mut check_cfg = CheckCfg { exhaustive_names, exhaustive_values, ..CheckCfg::default() };
124124

125-
let mut old_syntax = None;
126125
for s in specs {
127126
let sess = ParseSess::with_silent_emitter(Some(format!(
128127
"this error occurred on the command line: `--check-cfg={s}`"
@@ -160,174 +159,101 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
160159
expected_error();
161160
};
162161

163-
let mut set_old_syntax = || {
164-
// defaults are flipped for the old syntax
165-
if old_syntax == None {
166-
check_cfg.exhaustive_names = false;
167-
check_cfg.exhaustive_values = false;
168-
}
169-
old_syntax = Some(true);
170-
};
171-
172-
if meta_item.has_name(sym::names) {
173-
set_old_syntax();
174-
175-
check_cfg.exhaustive_names = true;
176-
for arg in args {
177-
if arg.is_word()
178-
&& let Some(ident) = arg.ident()
179-
{
180-
check_cfg.expecteds.entry(ident.name).or_insert(ExpectedValues::Any);
181-
} else {
182-
error!("`names()` arguments must be simple identifiers");
183-
}
184-
}
185-
} else if meta_item.has_name(sym::values) {
186-
set_old_syntax();
187-
188-
if let Some((name, values)) = args.split_first() {
189-
if name.is_word()
190-
&& let Some(ident) = name.ident()
191-
{
192-
let expected_values = check_cfg
193-
.expecteds
194-
.entry(ident.name)
195-
.and_modify(|expected_values| match expected_values {
196-
ExpectedValues::Some(_) => {}
197-
ExpectedValues::Any => {
198-
// handle the case where names(...) was done
199-
// before values by changing to a list
200-
*expected_values = ExpectedValues::Some(FxHashSet::default());
201-
}
202-
})
203-
.or_insert_with(|| ExpectedValues::Some(FxHashSet::default()));
162+
if !meta_item.has_name(sym::cfg) {
163+
expected_error();
164+
}
204165

205-
let ExpectedValues::Some(expected_values) = expected_values else {
206-
bug!("`expected_values` should be a list a values")
207-
};
166+
let mut names = Vec::new();
167+
let mut values: FxHashSet<_> = Default::default();
208168

209-
for val in values {
210-
if let Some(LitKind::Str(s, _)) = val.lit().map(|lit| &lit.kind) {
211-
expected_values.insert(Some(*s));
212-
} else {
213-
error!("`values()` arguments must be string literals");
214-
}
215-
}
169+
let mut any_specified = false;
170+
let mut values_specified = false;
171+
let mut values_any_specified = false;
216172

217-
if values.is_empty() {
218-
expected_values.insert(None);
219-
}
220-
} else {
221-
error!("`values()` first argument must be a simple identifier");
173+
for arg in args {
174+
if arg.is_word()
175+
&& let Some(ident) = arg.ident()
176+
{
177+
if values_specified {
178+
error!("`cfg()` names cannot be after values");
222179
}
223-
} else if args.is_empty() {
224-
check_cfg.exhaustive_values = true;
225-
} else {
226-
expected_error();
227-
}
228-
} else if meta_item.has_name(sym::cfg) {
229-
old_syntax = Some(false);
230-
231-
let mut names = Vec::new();
232-
let mut values: FxHashSet<_> = Default::default();
233-
234-
let mut any_specified = false;
235-
let mut values_specified = false;
236-
let mut values_any_specified = false;
237-
238-
for arg in args {
239-
if arg.is_word()
240-
&& let Some(ident) = arg.ident()
241-
{
242-
if values_specified {
243-
error!("`cfg()` names cannot be after values");
244-
}
245-
names.push(ident);
246-
} else if arg.has_name(sym::any)
247-
&& let Some(args) = arg.meta_item_list()
248-
{
249-
if any_specified {
250-
error!("`any()` cannot be specified multiple times");
251-
}
252-
any_specified = true;
253-
if !args.is_empty() {
254-
error!("`any()` must be empty");
255-
}
256-
} else if arg.has_name(sym::values)
257-
&& let Some(args) = arg.meta_item_list()
258-
{
259-
if names.is_empty() {
260-
error!("`values()` cannot be specified before the names");
261-
} else if values_specified {
262-
error!("`values()` cannot be specified multiple times");
263-
}
264-
values_specified = true;
265-
266-
for arg in args {
267-
if let Some(LitKind::Str(s, _)) = arg.lit().map(|lit| &lit.kind) {
268-
values.insert(Some(*s));
269-
} else if arg.has_name(sym::any)
270-
&& let Some(args) = arg.meta_item_list()
271-
{
272-
if values_any_specified {
273-
error!("`any()` in `values()` cannot be specified multiple times");
274-
}
275-
values_any_specified = true;
276-
if !args.is_empty() {
277-
error!("`any()` must be empty");
278-
}
279-
} else {
280-
error!("`values()` arguments must be string literals or `any()`");
180+
names.push(ident);
181+
} else if arg.has_name(sym::any)
182+
&& let Some(args) = arg.meta_item_list()
183+
{
184+
if any_specified {
185+
error!("`any()` cannot be specified multiple times");
186+
}
187+
any_specified = true;
188+
if !args.is_empty() {
189+
error!("`any()` must be empty");
190+
}
191+
} else if arg.has_name(sym::values)
192+
&& let Some(args) = arg.meta_item_list()
193+
{
194+
if names.is_empty() {
195+
error!("`values()` cannot be specified before the names");
196+
} else if values_specified {
197+
error!("`values()` cannot be specified multiple times");
198+
}
199+
values_specified = true;
200+
201+
for arg in args {
202+
if let Some(LitKind::Str(s, _)) = arg.lit().map(|lit| &lit.kind) {
203+
values.insert(Some(*s));
204+
} else if arg.has_name(sym::any)
205+
&& let Some(args) = arg.meta_item_list()
206+
{
207+
if values_any_specified {
208+
error!("`any()` in `values()` cannot be specified multiple times");
209+
}
210+
values_any_specified = true;
211+
if !args.is_empty() {
212+
error!("`any()` must be empty");
281213
}
214+
} else {
215+
error!("`values()` arguments must be string literals or `any()`");
282216
}
283-
} else {
284-
error!(
285-
"`cfg()` arguments must be simple identifiers, `any()` or `values(...)`"
286-
);
287217
}
218+
} else {
219+
error!("`cfg()` arguments must be simple identifiers, `any()` or `values(...)`");
288220
}
221+
}
289222

290-
if values.is_empty() && !values_any_specified && !any_specified {
291-
values.insert(None);
292-
} else if !values.is_empty() && values_any_specified {
293-
error!(
294-
"`values()` arguments cannot specify string literals and `any()` at the same time"
295-
);
296-
}
223+
if values.is_empty() && !values_any_specified && !any_specified {
224+
values.insert(None);
225+
} else if !values.is_empty() && values_any_specified {
226+
error!(
227+
"`values()` arguments cannot specify string literals and `any()` at the same time"
228+
);
229+
}
297230

298-
if any_specified {
299-
if names.is_empty()
300-
&& values.is_empty()
301-
&& !values_specified
302-
&& !values_any_specified
303-
{
304-
check_cfg.exhaustive_names = false;
305-
} else {
306-
error!("`cfg(any())` can only be provided in isolation");
307-
}
231+
if any_specified {
232+
if names.is_empty() && values.is_empty() && !values_specified && !values_any_specified {
233+
check_cfg.exhaustive_names = false;
308234
} else {
309-
for name in names {
310-
check_cfg
311-
.expecteds
312-
.entry(name.name)
313-
.and_modify(|v| match v {
314-
ExpectedValues::Some(v) if !values_any_specified => {
315-
v.extend(values.clone())
316-
}
317-
ExpectedValues::Some(_) => *v = ExpectedValues::Any,
318-
ExpectedValues::Any => {}
319-
})
320-
.or_insert_with(|| {
321-
if values_any_specified {
322-
ExpectedValues::Any
323-
} else {
324-
ExpectedValues::Some(values.clone())
325-
}
326-
});
327-
}
235+
error!("`cfg(any())` can only be provided in isolation");
328236
}
329237
} else {
330-
expected_error();
238+
for name in names {
239+
check_cfg
240+
.expecteds
241+
.entry(name.name)
242+
.and_modify(|v| match v {
243+
ExpectedValues::Some(v) if !values_any_specified => {
244+
v.extend(values.clone())
245+
}
246+
ExpectedValues::Some(_) => *v = ExpectedValues::Any,
247+
ExpectedValues::Any => {}
248+
})
249+
.or_insert_with(|| {
250+
if values_any_specified {
251+
ExpectedValues::Any
252+
} else {
253+
ExpectedValues::Some(values.clone())
254+
}
255+
});
256+
}
331257
}
332258
}
333259

‎src/doc/unstable-book/src/compiler-flags/check-cfg.md

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -190,70 +190,3 @@ fn shoot_lasers() {}
190190
// the cfg(feature) list
191191
fn write_shakespeare() {}
192192
```
193-
194-
## The deprecated `names(...)` form
195-
196-
The `names(...)` form enables checking the names. This form uses a named list:
197-
198-
```bash
199-
rustc --check-cfg 'names(name1, name2, ... nameN)'
200-
```
201-
202-
where each `name` is a bare identifier (has no quotes). The order of the names is not significant.
203-
204-
If `--check-cfg names(...)` is specified at least once, then `rustc` will check all references to
205-
condition names. `rustc` will check every `#[cfg]` attribute, `#[cfg_attr]` attribute, `cfg` clause
206-
inside `#[link]` attribute and `cfg!(...)` call against the provided list of expected condition
207-
names. If a name is not present in this list, then `rustc` will report an `unexpected_cfgs` lint
208-
diagnostic. The default diagnostic level for this lint is `Warn`.
209-
210-
If `--check-cfg names(...)` is not specified, then `rustc` will not check references to condition
211-
names.
212-
213-
`--check-cfg names(...)` may be specified more than once. The result is that the list of valid
214-
condition names is merged across all options. It is legal for a condition name to be specified
215-
more than once; redundantly specifying a condition name has no effect.
216-
217-
To enable checking condition names with an empty set of valid condition names, use the following
218-
form. The parentheses are required.
219-
220-
```bash
221-
rustc --check-cfg 'names()'
222-
```
223-
224-
Note that `--check-cfg 'names()'` is _not_ equivalent to omitting the option entirely.
225-
The first form enables checking condition names, while specifying that there are no valid
226-
condition names (outside of the set of well-known names defined by `rustc`). Omitting the
227-
`--check-cfg 'names(...)'` option does not enable checking condition names.
228-
229-
## The deprecated `values(...)` form
230-
231-
The `values(...)` form enables checking the values within list-valued conditions. It has this
232-
form:
233-
234-
```bash
235-
rustc --check-cfg `values(name, "value1", "value2", ... "valueN")'
236-
```
237-
238-
where `name` is a bare identifier (has no quotes) and each `"value"` term is a quoted literal
239-
string. `name` specifies the name of the condition, such as `feature` or `target_os`.
240-
241-
When the `values(...)` option is specified, `rustc` will check every `#[cfg(name = "value")]`
242-
attribute, `#[cfg_attr(name = "value")]` attribute, `#[link(name = "a", cfg(name = "value"))]`
243-
and `cfg!(name = "value")` call. It will check that the `"value"` specified is present in the
244-
list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
245-
lint diagnostic. The default diagnostic level for this lint is `Warn`.
246-
247-
To enable checking of values, but to provide an empty set of valid values, use this form:
248-
249-
```bash
250-
rustc --check-cfg `values(name)`
251-
```
252-
253-
The `--check-cfg values(...)` option can be repeated, both for the same condition name and for
254-
different names. If it is repeated for the same condition name, then the sets of values for that
255-
condition are merged together.
256-
257-
If `values()` is specified, then `rustc` will enable the checking of well-known values defined
258-
by itself. Note that it's necessary to specify the `values()` form to enable the checking of
259-
well known values, specifying the other forms doesn't implicitly enable it.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition name: `unknown_key`
2-
--> $DIR/exhaustive-names-values.rs:11:7
2+
--> $DIR/exhaustive-names-values.rs:10:7
33
|
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #[cfg(unknown_key = "value")]
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: unexpected `cfg` condition value: `value`
11-
--> $DIR/exhaustive-names-values.rs:15:7
11+
--> $DIR/exhaustive-names-values.rs:14:7
1212
|
1313
LL | #[cfg(test = "value")]
1414
| ^^^^----------
@@ -18,13 +18,13 @@ LL | #[cfg(test = "value")]
1818
= note: no expected value for `test`
1919

2020
warning: unexpected `cfg` condition name: `feature`
21-
--> $DIR/exhaustive-names-values.rs:19:7
21+
--> $DIR/exhaustive-names-values.rs:18:7
2222
|
2323
LL | #[cfg(feature = "unk")]
2424
| ^^^^^^^^^^^^^^^
2525

2626
warning: unexpected `cfg` condition name: `feature`
27-
--> $DIR/exhaustive-names-values.rs:26:7
27+
--> $DIR/exhaustive-names-values.rs:25:7
2828
|
2929
LL | #[cfg(feature = "std")]
3030
| ^^^^^^^^^^^^^^^

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition name: `unknown_key`
2-
--> $DIR/exhaustive-names-values.rs:11:7
2+
--> $DIR/exhaustive-names-values.rs:10:7
33
|
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #[cfg(unknown_key = "value")]
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: unexpected `cfg` condition value: `value`
11-
--> $DIR/exhaustive-names-values.rs:15:7
11+
--> $DIR/exhaustive-names-values.rs:14:7
1212
|
1313
LL | #[cfg(test = "value")]
1414
| ^^^^----------
@@ -18,7 +18,7 @@ LL | #[cfg(test = "value")]
1818
= note: no expected value for `test`
1919

2020
warning: unexpected `cfg` condition value: `unk`
21-
--> $DIR/exhaustive-names-values.rs:19:7
21+
--> $DIR/exhaustive-names-values.rs:18:7
2222
|
2323
LL | #[cfg(feature = "unk")]
2424
| ^^^^^^^^^^^^^^^

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition name: `unknown_key`
2-
--> $DIR/exhaustive-names-values.rs:11:7
2+
--> $DIR/exhaustive-names-values.rs:10:7
33
|
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #[cfg(unknown_key = "value")]
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: unexpected `cfg` condition value: `value`
11-
--> $DIR/exhaustive-names-values.rs:15:7
11+
--> $DIR/exhaustive-names-values.rs:14:7
1212
|
1313
LL | #[cfg(test = "value")]
1414
| ^^^^----------
@@ -18,7 +18,7 @@ LL | #[cfg(test = "value")]
1818
= note: no expected value for `test`
1919

2020
warning: unexpected `cfg` condition value: `unk`
21-
--> $DIR/exhaustive-names-values.rs:19:7
21+
--> $DIR/exhaustive-names-values.rs:18:7
2222
|
2323
LL | #[cfg(feature = "unk")]
2424
| ^^^^^^^^^^^^^^^

‎tests/ui/check-cfg/exhaustive-names-values.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Check warning for unexpected cfg in the code.
22
//
33
// check-pass
4-
// revisions: empty_names_values empty_cfg feature full
4+
// revisions: empty_cfg feature full
55
// compile-flags: -Z unstable-options
6-
// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values()
76
// [empty_cfg]compile-flags: --check-cfg=cfg()
87
// [feature]compile-flags: --check-cfg=cfg(feature,values("std"))
98
// [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg()

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Check warning for unexpected cfg
22
//
33
// check-pass
4-
// revisions: empty_names exhaustive_names
5-
// [empty_names]compile-flags: --check-cfg=names() -Z unstable-options
6-
// [exhaustive_names]compile-flags: --check-cfg=cfg() -Z unstable-options
4+
// compile-flags: --check-cfg=cfg() -Z unstable-options
75

86
#[cfg(unknown_key = "value")]
97
//~^ WARNING unexpected `cfg` condition name

‎tests/ui/check-cfg/exhaustive-names.empty_names.stderr renamed to ‎tests/ui/check-cfg/exhaustive-names.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition name: `unknown_key`
2-
--> $DIR/exhaustive-names.rs:8:7
2+
--> $DIR/exhaustive-names.rs:6:7
33
|
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `value`
2-
--> $DIR/exhaustive-values.rs:9:7
2+
--> $DIR/exhaustive-values.rs:8:7
33
|
44
LL | #[cfg(test = "value")]
55
| ^^^^----------

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

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

‎tests/ui/check-cfg/exhaustive-values.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Check warning for unexpected cfg value
22
//
33
// check-pass
4-
// revisions: empty_values empty_cfg without_names
5-
// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options
4+
// revisions: empty_cfg without_names
65
// [empty_cfg]compile-flags: --check-cfg=cfg() -Z unstable-options
76
// [without_names]compile-flags: --check-cfg=cfg(any()) -Z unstable-options
87

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `value`
2-
--> $DIR/exhaustive-values.rs:9:7
2+
--> $DIR/exhaustive-values.rs:8:7
33
|
44
LL | #[cfg(test = "value")]
55
| ^^^^----------

‎tests/ui/check-cfg/invalid-arguments.names_simple_ident.stderr

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

‎tests/ui/check-cfg/invalid-arguments.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Check that invalid --check-cfg are rejected
22
//
33
// check-fail
4-
// revisions: anything_else names_simple_ident values_simple_ident values_string_literals
4+
// revisions: anything_else
55
// revisions: string_for_name_1 string_for_name_2 multiple_any multiple_values
66
// revisions: multiple_values_any not_empty_any not_empty_values_any
77
// revisions: values_any_missing_values values_any_before_ident ident_in_values_1
@@ -10,9 +10,6 @@
1010
//
1111
// compile-flags: -Z unstable-options
1212
// [anything_else]compile-flags: --check-cfg=anything_else(...)
13-
// [names_simple_ident]compile-flags: --check-cfg=names("NOT_IDENT")
14-
// [values_simple_ident]compile-flags: --check-cfg=values("NOT_IDENT")
15-
// [values_string_literals]compile-flags: --check-cfg=values(test,12)
1613
// [string_for_name_1]compile-flags: --check-cfg=cfg("NOT_IDENT")
1714
// [string_for_name_2]compile-flags: --check-cfg=cfg(foo,"NOT_IDENT",bar)
1815
// [multiple_any]compile-flags: --check-cfg=cfg(any(),any())

‎tests/ui/check-cfg/invalid-arguments.values_simple_ident.stderr

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

‎tests/ui/check-cfg/invalid-arguments.values_string_literals.stderr

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

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// This test checks the combination of well known names, their activation via names(),
2-
// the usage of values(), and that no implicit is done with --cfg while also testing that
1+
// This test checks the combination of well known names, the usage of cfg(),
2+
// and that no implicit cfgs is added from --cfg while also testing that
33
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
44
//
55
// check-pass
6-
// revisions: names_values cfg
76
// compile-flags: --cfg feature="bar" --cfg unknown_name -Z unstable-options
8-
// compile-flags: --check-cfg=cfg(names_values,cfg)
9-
// [names_values]compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo")
10-
// [cfg]compile-flags: --check-cfg=cfg(feature,values("foo"))
7+
// compile-flags: --check-cfg=cfg(feature,values("foo"))
118

129
#[cfg(windows)]
1310
fn do_windows_stuff() {}

‎tests/ui/check-cfg/mix.names_values.stderr renamed to ‎tests/ui/check-cfg/mix.stderr

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,179 @@
11
warning: unexpected `cfg` condition name: `widnows`
2-
--> $DIR/mix.rs:15:7
2+
--> $DIR/mix.rs:12:7
33
|
44
LL | #[cfg(widnows)]
55
| ^^^^^^^ help: there is a config with a similar name: `windows`
66
|
77
= note: `#[warn(unexpected_cfgs)]` on by default
88

99
warning: unexpected `cfg` condition value: (none)
10-
--> $DIR/mix.rs:19:7
10+
--> $DIR/mix.rs:16:7
1111
|
1212
LL | #[cfg(feature)]
1313
| ^^^^^^^- help: specify a config value: `= "foo"`
1414
|
1515
= note: expected values for `feature` are: `foo`
1616

1717
warning: unexpected `cfg` condition value: `bar`
18-
--> $DIR/mix.rs:26:7
18+
--> $DIR/mix.rs:23:7
1919
|
2020
LL | #[cfg(feature = "bar")]
2121
| ^^^^^^^^^^^^^^^
2222
|
2323
= note: expected values for `feature` are: `foo`
2424

2525
warning: unexpected `cfg` condition value: `zebra`
26-
--> $DIR/mix.rs:30:7
26+
--> $DIR/mix.rs:27:7
2727
|
2828
LL | #[cfg(feature = "zebra")]
2929
| ^^^^^^^^^^^^^^^^^
3030
|
3131
= note: expected values for `feature` are: `foo`
3232

3333
warning: unexpected `cfg` condition name: `uu`
34-
--> $DIR/mix.rs:34:12
34+
--> $DIR/mix.rs:31:12
3535
|
3636
LL | #[cfg_attr(uu, test)]
3737
| ^^
3838
|
39-
= help: expected names are: `cfg`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `names_values`, `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`
39+
= 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`
4040

4141
warning: unexpected `cfg` condition name: `widnows`
42-
--> $DIR/mix.rs:43:10
42+
--> $DIR/mix.rs:40:10
4343
|
4444
LL | cfg!(widnows);
4545
| ^^^^^^^ help: there is a config with a similar name: `windows`
4646

4747
warning: unexpected `cfg` condition value: `bar`
48-
--> $DIR/mix.rs:46:10
48+
--> $DIR/mix.rs:43:10
4949
|
5050
LL | cfg!(feature = "bar");
5151
| ^^^^^^^^^^^^^^^
5252
|
5353
= note: expected values for `feature` are: `foo`
5454

5555
warning: unexpected `cfg` condition value: `zebra`
56-
--> $DIR/mix.rs:48:10
56+
--> $DIR/mix.rs:45:10
5757
|
5858
LL | cfg!(feature = "zebra");
5959
| ^^^^^^^^^^^^^^^^^
6060
|
6161
= note: expected values for `feature` are: `foo`
6262

6363
warning: unexpected `cfg` condition name: `xxx`
64-
--> $DIR/mix.rs:50:10
64+
--> $DIR/mix.rs:47:10
6565
|
6666
LL | cfg!(xxx = "foo");
6767
| ^^^^^^^^^^^
6868

6969
warning: unexpected `cfg` condition name: `xxx`
70-
--> $DIR/mix.rs:52:10
70+
--> $DIR/mix.rs:49:10
7171
|
7272
LL | cfg!(xxx);
7373
| ^^^
7474

7575
warning: unexpected `cfg` condition name: `xxx`
76-
--> $DIR/mix.rs:54:14
76+
--> $DIR/mix.rs:51:14
7777
|
7878
LL | cfg!(any(xxx, windows));
7979
| ^^^
8080

8181
warning: unexpected `cfg` condition value: `bad`
82-
--> $DIR/mix.rs:56:14
82+
--> $DIR/mix.rs:53:14
8383
|
8484
LL | cfg!(any(feature = "bad", windows));
8585
| ^^^^^^^^^^^^^^^
8686
|
8787
= note: expected values for `feature` are: `foo`
8888

8989
warning: unexpected `cfg` condition name: `xxx`
90-
--> $DIR/mix.rs:58:23
90+
--> $DIR/mix.rs:55:23
9191
|
9292
LL | cfg!(any(windows, xxx));
9393
| ^^^
9494

9595
warning: unexpected `cfg` condition name: `xxx`
96-
--> $DIR/mix.rs:60:20
96+
--> $DIR/mix.rs:57:20
9797
|
9898
LL | cfg!(all(unix, xxx));
9999
| ^^^
100100

101101
warning: unexpected `cfg` condition name: `aa`
102-
--> $DIR/mix.rs:62:14
102+
--> $DIR/mix.rs:59:14
103103
|
104104
LL | cfg!(all(aa, bb));
105105
| ^^
106106

107107
warning: unexpected `cfg` condition name: `bb`
108-
--> $DIR/mix.rs:62:18
108+
--> $DIR/mix.rs:59:18
109109
|
110110
LL | cfg!(all(aa, bb));
111111
| ^^
112112

113113
warning: unexpected `cfg` condition name: `aa`
114-
--> $DIR/mix.rs:65:14
114+
--> $DIR/mix.rs:62:14
115115
|
116116
LL | cfg!(any(aa, bb));
117117
| ^^
118118

119119
warning: unexpected `cfg` condition name: `bb`
120-
--> $DIR/mix.rs:65:18
120+
--> $DIR/mix.rs:62:18
121121
|
122122
LL | cfg!(any(aa, bb));
123123
| ^^
124124

125125
warning: unexpected `cfg` condition value: `zebra`
126-
--> $DIR/mix.rs:68:20
126+
--> $DIR/mix.rs:65:20
127127
|
128128
LL | cfg!(any(unix, feature = "zebra"));
129129
| ^^^^^^^^^^^^^^^^^
130130
|
131131
= note: expected values for `feature` are: `foo`
132132

133133
warning: unexpected `cfg` condition name: `xxx`
134-
--> $DIR/mix.rs:70:14
134+
--> $DIR/mix.rs:67:14
135135
|
136136
LL | cfg!(any(xxx, feature = "zebra"));
137137
| ^^^
138138

139139
warning: unexpected `cfg` condition value: `zebra`
140-
--> $DIR/mix.rs:70:19
140+
--> $DIR/mix.rs:67:19
141141
|
142142
LL | cfg!(any(xxx, feature = "zebra"));
143143
| ^^^^^^^^^^^^^^^^^
144144
|
145145
= note: expected values for `feature` are: `foo`
146146

147147
warning: unexpected `cfg` condition name: `xxx`
148-
--> $DIR/mix.rs:73:14
148+
--> $DIR/mix.rs:70:14
149149
|
150150
LL | cfg!(any(xxx, unix, xxx));
151151
| ^^^
152152

153153
warning: unexpected `cfg` condition name: `xxx`
154-
--> $DIR/mix.rs:73:25
154+
--> $DIR/mix.rs:70:25
155155
|
156156
LL | cfg!(any(xxx, unix, xxx));
157157
| ^^^
158158

159159
warning: unexpected `cfg` condition value: `zebra`
160-
--> $DIR/mix.rs:76:14
160+
--> $DIR/mix.rs:73:14
161161
|
162162
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
163163
| ^^^^^^^^^^^^^^^^^
164164
|
165165
= note: expected values for `feature` are: `foo`
166166

167167
warning: unexpected `cfg` condition value: `zebra`
168-
--> $DIR/mix.rs:76:33
168+
--> $DIR/mix.rs:73:33
169169
|
170170
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
171171
| ^^^^^^^^^^^^^^^^^
172172
|
173173
= note: expected values for `feature` are: `foo`
174174

175175
warning: unexpected `cfg` condition value: `zebra`
176-
--> $DIR/mix.rs:76:52
176+
--> $DIR/mix.rs:73:52
177177
|
178178
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
179179
| ^^^^^^^^^^^^^^^^^

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `foo`
2-
--> $DIR/no-expected-values.rs:12:7
2+
--> $DIR/no-expected-values.rs:11:7
33
|
44
LL | #[cfg(feature = "foo")]
55
| ^^^^^^^--------
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "foo")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: `foo`
13-
--> $DIR/no-expected-values.rs:16:7
13+
--> $DIR/no-expected-values.rs:15:7
1414
|
1515
LL | #[cfg(test = "foo")]
1616
| ^^^^--------

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `foo`
2-
--> $DIR/no-expected-values.rs:12:7
2+
--> $DIR/no-expected-values.rs:11:7
33
|
44
LL | #[cfg(feature = "foo")]
55
| ^^^^^^^--------
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "foo")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: `foo`
13-
--> $DIR/no-expected-values.rs:16:7
13+
--> $DIR/no-expected-values.rs:15:7
1414
|
1515
LL | #[cfg(test = "foo")]
1616
| ^^^^--------

‎tests/ui/check-cfg/no-expected-values.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Check that we detect unexpected value when none are allowed
22
//
33
// check-pass
4-
// revisions: values simple mixed empty
4+
// revisions: simple mixed empty
55
// compile-flags: -Z unstable-options
66
// compile-flags: --check-cfg=cfg(values,simple,mixed,empty)
7-
// [values]compile-flags: --check-cfg=values(test) --check-cfg=values(feature)
87
// [simple]compile-flags: --check-cfg=cfg(test) --check-cfg=cfg(feature)
98
// [mixed]compile-flags: --check-cfg=cfg(test,feature)
109
// [empty]compile-flags: --check-cfg=cfg(test,feature,values())

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `foo`
2-
--> $DIR/no-expected-values.rs:12:7
2+
--> $DIR/no-expected-values.rs:11:7
33
|
44
LL | #[cfg(feature = "foo")]
55
| ^^^^^^^--------
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "foo")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: `foo`
13-
--> $DIR/no-expected-values.rs:16:7
13+
--> $DIR/no-expected-values.rs:15:7
1414
|
1515
LL | #[cfg(test = "foo")]
1616
| ^^^^--------

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

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

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

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

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

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

‎tests/ui/check-cfg/order-independant.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// check-pass
2-
// revisions: names_before names_after
2+
//
3+
// revisions: values_before values_after
34
// compile-flags: -Z unstable-options
4-
// compile-flags: --check-cfg=names(names_before,names_after)
5-
// [names_before]compile-flags: --check-cfg=names(a) --check-cfg=values(a,"b")
6-
// [names_after]compile-flags: --check-cfg=values(a,"b") --check-cfg=names(a)
5+
// compile-flags: --check-cfg=cfg(values_before,values_after)
6+
//
7+
// [values_before]compile-flags: --check-cfg=cfg(a,values("b")) --check-cfg=cfg(a)
8+
// [values_after]compile-flags: --check-cfg=cfg(a) --check-cfg=cfg(a,values("b"))
79

810
#[cfg(a)]
9-
//~^ WARNING unexpected `cfg` condition value
1011
fn my_cfg() {}
1112

1213
#[cfg(a = "unk")]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: unexpected `cfg` condition value: `unk`
2+
--> $DIR/order-independant.rs:13:7
3+
|
4+
LL | #[cfg(a = "unk")]
5+
| ^^^^^^^^^
6+
|
7+
= note: expected values for `a` are: (none), `b`
8+
= note: `#[warn(unexpected_cfgs)]` on by default
9+
10+
warning: 1 warning emitted
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: unexpected `cfg` condition value: `unk`
2+
--> $DIR/order-independant.rs:13:7
3+
|
4+
LL | #[cfg(a = "unk")]
5+
| ^^^^^^^^^
6+
|
7+
= note: expected values for `a` are: (none), `b`
8+
= note: `#[warn(unexpected_cfgs)]` on by default
9+
10+
warning: 1 warning emitted
11+

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

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

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Check warning for unexpected configuration name
22
//
33
// check-pass
4-
// revisions: names exhaustive
5-
// compile-flags: --check-cfg=cfg(names,exhaustive)
6-
// [names]compile-flags: --check-cfg=names() -Z unstable-options
7-
// [exhaustive]compile-flags: --check-cfg=cfg() -Z unstable-options
4+
// compile-flags: --check-cfg=cfg() -Z unstable-options
85

96
#[cfg(widnows)]
107
//~^ WARNING unexpected `cfg` condition name

‎tests/ui/check-cfg/unexpected-cfg-name.names.stderr renamed to ‎tests/ui/check-cfg/unexpected-cfg-name.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition name: `widnows`
2-
--> $DIR/unexpected-cfg-name.rs:9:7
2+
--> $DIR/unexpected-cfg-name.rs:6:7
33
|
44
LL | #[cfg(widnows)]
55
| ^^^^^^^ help: there is a config with a similar name: `windows`

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// Check for unexpected configuration value in the code.
22
//
33
// check-pass
4-
// revisions: values cfg
5-
// compile-flags: -Z unstable-options
6-
// [values]compile-flags: --check-cfg=values(feature,"serde","full")
7-
// [cfg]compile-flags: --check-cfg=cfg(feature,values("serde","full"))
4+
// compile-flags: --cfg=feature="rand" -Z unstable-options
5+
// compile-flags: --check-cfg=cfg(feature,values("serde","full"))
86

97
#[cfg(feature = "sedre")]
108
//~^ WARNING unexpected `cfg` condition value

‎tests/ui/check-cfg/unexpected-cfg-value.values.stderr renamed to ‎tests/ui/check-cfg/unexpected-cfg-value.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value: `sedre`
2-
--> $DIR/unexpected-cfg-value.rs:9:7
2+
--> $DIR/unexpected-cfg-value.rs:7:7
33
|
44
LL | #[cfg(feature = "sedre")]
55
| ^^^^^^^^^^-------
@@ -10,7 +10,7 @@ LL | #[cfg(feature = "sedre")]
1010
= note: `#[warn(unexpected_cfgs)]` on by default
1111

1212
warning: unexpected `cfg` condition value: `rand`
13-
--> $DIR/unexpected-cfg-value.rs:16:7
13+
--> $DIR/unexpected-cfg-value.rs:14:7
1414
|
1515
LL | #[cfg(feature = "rand")]
1616
| ^^^^^^^^^^^^^^^^

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// check-pass
44
// needs-llvm-components: x86
5-
// compile-flags: --crate-type=lib --check-cfg=values() --target={{src-base}}/check-cfg/my-awesome-platform.json -Z unstable-options
5+
// compile-flags: --crate-type=lib --check-cfg=cfg() --target={{src-base}}/check-cfg/my-awesome-platform.json -Z unstable-options
66

77
#![feature(lang_items, no_core, auto_traits)]
88
#![no_core]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// compile-flags: --check-cfg "names()"
1+
// compile-flags: --check-cfg "cfg()"
22

33
fn main() {}

0 commit comments

Comments
 (0)
Please sign in to comment.