Skip to content

Commit e68a385

Browse files
committed
Use all the known features in check-cfg
1 parent 1a72d8a commit e68a385

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

compiler/rustc_session/src/config.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1485,10 +1485,8 @@ impl CheckCfg {
14851485
ins!(sym::sanitizer_cfi_generalize_pointers, no_values);
14861486
ins!(sym::sanitizer_cfi_normalize_integers, no_values);
14871487

1488-
// rustc_codegen_ssa has a list of known target features and their
1489-
// stability, but we should allow any target feature as a new target or
1490-
// rustc version may introduce new target features.
1491-
ins!(sym::target_feature, || ExpectedValues::Any);
1488+
ins!(sym::target_feature, empty_values)
1489+
.extend(crate::target_features::all_known_features().map(|(f, _sb)| Symbol::intern(f)));
14921490

14931491
// sym::target_*
14941492
{

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
//~^ WARN unexpected `cfg` condition value
5252
target_family = "_UNEXPECTED_VALUE",
5353
//~^ WARN unexpected `cfg` condition value
54-
target_feature = "_UNEXPECTED_VALUE", // currently *any* values are "expected"
54+
target_feature = "_UNEXPECTED_VALUE",
55+
//~^ WARN unexpected `cfg` condition value
5556
target_has_atomic = "_UNEXPECTED_VALUE",
5657
//~^ WARN unexpected `cfg` condition value
5758
target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",

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

+20-12
Original file line numberDiff line numberDiff line change
@@ -124,47 +124,55 @@ LL | target_family = "_UNEXPECTED_VALUE",
124124
= note: expected values for `target_family` are: `unix`, `wasm`, `windows`
125125

126126
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
127-
--> $DIR/well-known-values.rs:55:5
127+
--> $DIR/well-known-values.rs:54:5
128+
|
129+
LL | target_feature = "_UNEXPECTED_VALUE",
130+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131+
|
132+
= note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512er`, `avx512f`, `avx512ifma`, `avx512pf`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `f`, `f16c`, `f32mm`, `f64mm`, `fast-unaligned-access`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sign-ext`, `simd128`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, `zkt`
133+
134+
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
135+
--> $DIR/well-known-values.rs:56:5
128136
|
129137
LL | target_has_atomic = "_UNEXPECTED_VALUE",
130138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131139
|
132140
= note: expected values for `target_has_atomic` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
133141

134142
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
135-
--> $DIR/well-known-values.rs:57:5
143+
--> $DIR/well-known-values.rs:58:5
136144
|
137145
LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
138146
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139147
|
140148
= note: expected values for `target_has_atomic_equal_alignment` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
141149

142150
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
143-
--> $DIR/well-known-values.rs:59:5
151+
--> $DIR/well-known-values.rs:60:5
144152
|
145153
LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE",
146154
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147155
|
148156
= note: expected values for `target_has_atomic_load_store` are: (none), `128`, `16`, `32`, `64`, `8`, `ptr`
149157

150158
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
151-
--> $DIR/well-known-values.rs:61:5
159+
--> $DIR/well-known-values.rs:62:5
152160
|
153161
LL | target_os = "_UNEXPECTED_VALUE",
154162
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155163
|
156164
= 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`
157165

158166
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
159-
--> $DIR/well-known-values.rs:63:5
167+
--> $DIR/well-known-values.rs:64:5
160168
|
161169
LL | target_pointer_width = "_UNEXPECTED_VALUE",
162170
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163171
|
164172
= note: expected values for `target_pointer_width` are: `16`, `32`, `64`
165173

166174
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
167-
--> $DIR/well-known-values.rs:65:5
175+
--> $DIR/well-known-values.rs:66:5
168176
|
169177
LL | target_thread_local = "_UNEXPECTED_VALUE",
170178
| ^^^^^^^^^^^^^^^^^^^----------------------
@@ -174,15 +182,15 @@ LL | target_thread_local = "_UNEXPECTED_VALUE",
174182
= note: no expected value for `target_thread_local`
175183

176184
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
177-
--> $DIR/well-known-values.rs:67:5
185+
--> $DIR/well-known-values.rs:68:5
178186
|
179187
LL | target_vendor = "_UNEXPECTED_VALUE",
180188
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
181189
|
182190
= note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, `wrs`
183191

184192
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
185-
--> $DIR/well-known-values.rs:69:5
193+
--> $DIR/well-known-values.rs:70:5
186194
|
187195
LL | test = "_UNEXPECTED_VALUE",
188196
| ^^^^----------------------
@@ -192,7 +200,7 @@ LL | test = "_UNEXPECTED_VALUE",
192200
= note: no expected value for `test`
193201

194202
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
195-
--> $DIR/well-known-values.rs:71:5
203+
--> $DIR/well-known-values.rs:72:5
196204
|
197205
LL | unix = "_UNEXPECTED_VALUE",
198206
| ^^^^----------------------
@@ -202,7 +210,7 @@ LL | unix = "_UNEXPECTED_VALUE",
202210
= note: no expected value for `unix`
203211

204212
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
205-
--> $DIR/well-known-values.rs:73:5
213+
--> $DIR/well-known-values.rs:74:5
206214
|
207215
LL | windows = "_UNEXPECTED_VALUE",
208216
| ^^^^^^^----------------------
@@ -212,7 +220,7 @@ LL | windows = "_UNEXPECTED_VALUE",
212220
= note: no expected value for `windows`
213221

214222
warning: unexpected `cfg` condition value: `linuz`
215-
--> $DIR/well-known-values.rs:79:7
223+
--> $DIR/well-known-values.rs:80:7
216224
|
217225
LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
218226
| ^^^^^^^^^^^^-------
@@ -221,5 +229,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
221229
|
222230
= 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`
223231

224-
warning: 25 warnings emitted
232+
warning: 26 warnings emitted
225233

0 commit comments

Comments
 (0)