Skip to content

Commit 9f15ace

Browse files
committed
Remove feature from the list of well known check-cfg name
1 parent 0ff8610 commit 9f15ace

11 files changed

+52
-18
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,9 +1443,8 @@ impl CheckCfg {
14431443
let relocation_model_values = RelocModel::all();
14441444

14451445
// Unknown possible values:
1446-
// - `feature`
14471446
// - `target_feature`
1448-
for name in [sym::feature, sym::target_feature] {
1447+
for name in [sym::target_feature] {
14491448
self.expecteds.entry(name).or_insert(ExpectedValues::Any);
14501449
}
14511450

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE`
44
LL | #[cfg(FALSE)]
55
| ^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture`
44
LL | #[cfg(target(os = "linux", architecture = "arm"))]
55
| ^^^^^^^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: unexpected `cfg` condition value: `value`
@@ -17,5 +17,17 @@ LL | #[cfg(test = "value")]
1717
|
1818
= note: no expected value for `test`
1919

20-
warning: 2 warnings emitted
20+
warning: unexpected `cfg` condition name: `feature`
21+
--> $DIR/exhaustive-names-values.rs:19:7
22+
|
23+
LL | #[cfg(feature = "unk")]
24+
| ^^^^^^^^^^^^^^^
25+
26+
warning: unexpected `cfg` condition name: `feature`
27+
--> $DIR/exhaustive-names-values.rs:26:7
28+
|
29+
LL | #[cfg(feature = "std")]
30+
| ^^^^^^^^^^^^^^^
31+
32+
warning: 4 warnings emitted
2133

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: unexpected `cfg` condition value: `value`
@@ -17,5 +17,17 @@ LL | #[cfg(test = "value")]
1717
|
1818
= note: no expected value for `test`
1919

20-
warning: 2 warnings emitted
20+
warning: unexpected `cfg` condition name: `feature`
21+
--> $DIR/exhaustive-names-values.rs:19:7
22+
|
23+
LL | #[cfg(feature = "unk")]
24+
| ^^^^^^^^^^^^^^^
25+
26+
warning: unexpected `cfg` condition name: `feature`
27+
--> $DIR/exhaustive-names-values.rs:26:7
28+
|
29+
LL | #[cfg(feature = "std")]
30+
| ^^^^^^^^^^^^^^^
31+
32+
warning: 4 warnings emitted
2133

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ pub fn f() {}
1717
pub fn f() {}
1818

1919
#[cfg(feature = "unk")]
20-
//[feature]~^ WARNING unexpected `cfg` condition value
21-
//[full]~^^ WARNING unexpected `cfg` condition value
20+
//[empty_names_values]~^ WARNING unexpected `cfg` condition name
21+
//[empty_cfg]~^^ WARNING unexpected `cfg` condition name
22+
//[feature]~^^^ WARNING unexpected `cfg` condition value
23+
//[full]~^^^^ WARNING unexpected `cfg` condition value
2224
pub fn feat() {}
2325

2426
#[cfg(feature = "std")]
27+
//[empty_names_values]~^ WARNING unexpected `cfg` condition name
28+
//[empty_cfg]~^^ WARNING unexpected `cfg` condition name
2529
pub fn feat() {}
2630

2731
#[cfg(windows)]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key`
44
LL | #[cfg(unknown_key = "value")]
55
| ^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom`
44
LL | #[cfg(crossbeam_loom)]
55
| ^^^^^^^^^^^^^^
66
|
7-
= 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`
7+
= 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`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

tests/ui/check-cfg/well-known-names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn target_os() {}
1515
fn feature_misspell() {}
1616

1717
#[cfg(feature = "foo")]
18+
//~^ WARNING unexpected `cfg` condition name
1819
fn feature() {}
1920

2021
#[cfg(uniw)]

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@ warning: unexpected `cfg` condition name: `features`
1414
--> $DIR/well-known-names.rs:13:7
1515
|
1616
LL | #[cfg(features = "foo")]
17-
| --------^^^^^^^^
18-
| |
19-
| help: there is a config with a similar name: `feature`
17+
| ^^^^^^^^^^^^^^^^
18+
|
19+
= 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`
20+
21+
warning: unexpected `cfg` condition name: `feature`
22+
--> $DIR/well-known-names.rs:17:7
23+
|
24+
LL | #[cfg(feature = "foo")]
25+
| ^^^^^^^^^^^^^^^
2026

2127
warning: unexpected `cfg` condition name: `uniw`
22-
--> $DIR/well-known-names.rs:20:7
28+
--> $DIR/well-known-names.rs:21:7
2329
|
2430
LL | #[cfg(uniw)]
2531
| ^^^^ help: there is a config with a similar name: `unix`
2632

27-
warning: 3 warnings emitted
33+
warning: 4 warnings emitted
2834

0 commit comments

Comments
 (0)