Skip to content

Commit a96f1a8

Browse files
authored
Rollup merge of #103067 - Nilstrieb:tidy-likes-the-alphabet, r=jackh726
More alphabetical sorting Sort and enforce a few more things. The biggest change here is sorting all target features.
2 parents 03a521b + b00cb04 commit a96f1a8

File tree

6 files changed

+170
-142
lines changed

6 files changed

+170
-142
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

+112-96
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,25 @@ pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"];
1313
// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted
1414

1515
const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
16+
// tidy-alphabetical-start
1617
("aclass", Some(sym::arm_target_feature)),
17-
("mclass", Some(sym::arm_target_feature)),
18-
("rclass", Some(sym::arm_target_feature)),
19-
("dsp", Some(sym::arm_target_feature)),
20-
("neon", Some(sym::arm_target_feature)),
18+
("aes", Some(sym::arm_target_feature)),
2119
("crc", Some(sym::arm_target_feature)),
2220
("crypto", Some(sym::arm_target_feature)),
23-
("aes", Some(sym::arm_target_feature)),
24-
("sha2", Some(sym::arm_target_feature)),
25-
("i8mm", Some(sym::arm_target_feature)),
21+
("d32", Some(sym::arm_target_feature)),
2622
("dotprod", Some(sym::arm_target_feature)),
23+
("dsp", Some(sym::arm_target_feature)),
24+
("fp-armv8", Some(sym::arm_target_feature)),
25+
("i8mm", Some(sym::arm_target_feature)),
26+
("mclass", Some(sym::arm_target_feature)),
27+
("neon", Some(sym::arm_target_feature)),
28+
("rclass", Some(sym::arm_target_feature)),
29+
("sha2", Some(sym::arm_target_feature)),
30+
// This is needed for inline assembly, but shouldn't be stabilized as-is
31+
// since it should be enabled per-function using #[instruction_set], not
32+
// #[target_feature].
33+
("thumb-mode", Some(sym::arm_target_feature)),
34+
("thumb2", Some(sym::arm_target_feature)),
2735
("v5te", Some(sym::arm_target_feature)),
2836
("v6", Some(sym::arm_target_feature)),
2937
("v6k", Some(sym::arm_target_feature)),
@@ -33,118 +41,115 @@ const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
3341
("vfp2", Some(sym::arm_target_feature)),
3442
("vfp3", Some(sym::arm_target_feature)),
3543
("vfp4", Some(sym::arm_target_feature)),
36-
("fp-armv8", Some(sym::arm_target_feature)),
37-
// This is needed for inline assembly, but shouldn't be stabilized as-is
38-
// since it should be enabled per-function using #[instruction_set], not
39-
// #[target_feature].
40-
("thumb-mode", Some(sym::arm_target_feature)),
41-
("thumb2", Some(sym::arm_target_feature)),
42-
("d32", Some(sym::arm_target_feature)),
44+
// tidy-alphabetical-end
4345
];
4446

4547
const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
46-
// FEAT_AdvSimd & FEAT_FP
47-
("neon", None),
48-
// FEAT_FP16
49-
("fp16", None),
50-
// FEAT_SVE
51-
("sve", None),
48+
// tidy-alphabetical-start
49+
// FEAT_AES
50+
("aes", None),
51+
// FEAT_BF16
52+
("bf16", None),
53+
// FEAT_BTI
54+
("bti", None),
5255
// FEAT_CRC
5356
("crc", None),
54-
// FEAT_RAS
55-
("ras", None),
56-
// FEAT_LSE
57-
("lse", None),
58-
// FEAT_RDM
59-
("rdm", None),
60-
// FEAT_RCPC
61-
("rcpc", None),
62-
// FEAT_RCPC2
63-
("rcpc2", None),
64-
// FEAT_DotProd
65-
("dotprod", None),
66-
// FEAT_TME
67-
("tme", None),
68-
// FEAT_FHM
69-
("fhm", None),
7057
// FEAT_DIT
7158
("dit", None),
72-
// FEAT_FLAGM
73-
("flagm", None),
74-
// FEAT_SSBS
75-
("ssbs", None),
76-
// FEAT_SB
77-
("sb", None),
78-
// FEAT_PAUTH (address authentication)
79-
("paca", None),
80-
// FEAT_PAUTH (generic authentication)
81-
("pacg", None),
59+
// FEAT_DotProd
60+
("dotprod", None),
8261
// FEAT_DPB
8362
("dpb", None),
8463
// FEAT_DPB2
8564
("dpb2", None),
86-
// FEAT_SVE2
87-
("sve2", None),
88-
// FEAT_SVE2_AES
89-
("sve2-aes", None),
90-
// FEAT_SVE2_SM4
91-
("sve2-sm4", None),
92-
// FEAT_SVE2_SHA3
93-
("sve2-sha3", None),
94-
// FEAT_SVE2_BitPerm
95-
("sve2-bitperm", None),
96-
// FEAT_FRINTTS
97-
("frintts", None),
98-
// FEAT_I8MM
99-
("i8mm", None),
10065
// FEAT_F32MM
10166
("f32mm", None),
10267
// FEAT_F64MM
10368
("f64mm", None),
104-
// FEAT_BF16
105-
("bf16", None),
106-
// FEAT_RAND
107-
("rand", None),
108-
// FEAT_BTI
109-
("bti", None),
110-
// FEAT_MTE
111-
("mte", None),
112-
// FEAT_JSCVT
113-
("jsconv", None),
11469
// FEAT_FCMA
11570
("fcma", None),
116-
// FEAT_AES
117-
("aes", None),
71+
// FEAT_FHM
72+
("fhm", None),
73+
// FEAT_FLAGM
74+
("flagm", None),
75+
// FEAT_FP16
76+
("fp16", None),
77+
// FEAT_FRINTTS
78+
("frintts", None),
79+
// FEAT_I8MM
80+
("i8mm", None),
81+
// FEAT_JSCVT
82+
("jsconv", None),
83+
// FEAT_LOR
84+
("lor", None),
85+
// FEAT_LSE
86+
("lse", None),
87+
// FEAT_MTE
88+
("mte", None),
89+
// FEAT_AdvSimd & FEAT_FP
90+
("neon", None),
91+
// FEAT_PAUTH (address authentication)
92+
("paca", None),
93+
// FEAT_PAUTH (generic authentication)
94+
("pacg", None),
95+
// FEAT_PAN
96+
("pan", None),
97+
// FEAT_PMUv3
98+
("pmuv3", None),
99+
// FEAT_RAND
100+
("rand", None),
101+
// FEAT_RAS
102+
("ras", None),
103+
// FEAT_RCPC
104+
("rcpc", None),
105+
// FEAT_RCPC2
106+
("rcpc2", None),
107+
// FEAT_RDM
108+
("rdm", None),
109+
// FEAT_SB
110+
("sb", None),
118111
// FEAT_SHA1 & FEAT_SHA256
119112
("sha2", None),
120113
// FEAT_SHA512 & FEAT_SHA3
121114
("sha3", None),
122115
// FEAT_SM3 & FEAT_SM4
123116
("sm4", None),
124-
// FEAT_PAN
125-
("pan", None),
126-
// FEAT_LOR
127-
("lor", None),
128-
// FEAT_VHE
129-
("vh", None),
130-
// FEAT_PMUv3
131-
("pmuv3", None),
132117
// FEAT_SPE
133118
("spe", None),
119+
// FEAT_SSBS
120+
("ssbs", None),
121+
// FEAT_SVE
122+
("sve", None),
123+
// FEAT_SVE2
124+
("sve2", None),
125+
// FEAT_SVE2_AES
126+
("sve2-aes", None),
127+
// FEAT_SVE2_BitPerm
128+
("sve2-bitperm", None),
129+
// FEAT_SVE2_SHA3
130+
("sve2-sha3", None),
131+
// FEAT_SVE2_SM4
132+
("sve2-sm4", None),
133+
// FEAT_TME
134+
("tme", None),
134135
("v8.1a", Some(sym::aarch64_ver_target_feature)),
135136
("v8.2a", Some(sym::aarch64_ver_target_feature)),
136137
("v8.3a", Some(sym::aarch64_ver_target_feature)),
137138
("v8.4a", Some(sym::aarch64_ver_target_feature)),
138139
("v8.5a", Some(sym::aarch64_ver_target_feature)),
139140
("v8.6a", Some(sym::aarch64_ver_target_feature)),
140141
("v8.7a", Some(sym::aarch64_ver_target_feature)),
142+
// FEAT_VHE
143+
("vh", None),
144+
// tidy-alphabetical-end
141145
];
142146

143147
const AARCH64_TIED_FEATURES: &[&[&str]] = &[
144148
&["paca", "pacg"], // Together these represent `pauth` in LLVM
145149
];
146150

147151
const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
152+
// tidy-alphabetical-start
148153
("adx", None),
149154
("aes", None),
150155
("avx", None),
@@ -194,69 +199,80 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
194199
("xsavec", None),
195200
("xsaveopt", None),
196201
("xsaves", None),
202+
// tidy-alphabetical-end
197203
];
198204

199205
const HEXAGON_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
206+
// tidy-alphabetical-start
200207
("hvx", Some(sym::hexagon_target_feature)),
201208
("hvx-length128b", Some(sym::hexagon_target_feature)),
209+
// tidy-alphabetical-end
202210
];
203211

204212
const POWERPC_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
213+
// tidy-alphabetical-start
205214
("altivec", Some(sym::powerpc_target_feature)),
206215
("power8-altivec", Some(sym::powerpc_target_feature)),
207-
("power9-altivec", Some(sym::powerpc_target_feature)),
208216
("power8-vector", Some(sym::powerpc_target_feature)),
217+
("power9-altivec", Some(sym::powerpc_target_feature)),
209218
("power9-vector", Some(sym::powerpc_target_feature)),
210219
("vsx", Some(sym::powerpc_target_feature)),
220+
// tidy-alphabetical-end
211221
];
212222

213223
const MIPS_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
224+
// tidy-alphabetical-start
214225
("fp64", Some(sym::mips_target_feature)),
215226
("msa", Some(sym::mips_target_feature)),
216227
("virt", Some(sym::mips_target_feature)),
228+
// tidy-alphabetical-end
217229
];
218230

219231
const RISCV_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
220-
("m", Some(sym::riscv_target_feature)),
232+
// tidy-alphabetical-start
221233
("a", Some(sym::riscv_target_feature)),
222234
("c", Some(sym::riscv_target_feature)),
223-
("f", Some(sym::riscv_target_feature)),
224235
("d", Some(sym::riscv_target_feature)),
225236
("e", Some(sym::riscv_target_feature)),
237+
("f", Some(sym::riscv_target_feature)),
238+
("m", Some(sym::riscv_target_feature)),
226239
("v", Some(sym::riscv_target_feature)),
227-
("zfinx", Some(sym::riscv_target_feature)),
228-
("zdinx", Some(sym::riscv_target_feature)),
229-
("zhinx", Some(sym::riscv_target_feature)),
230-
("zhinxmin", Some(sym::riscv_target_feature)),
231-
("zfh", Some(sym::riscv_target_feature)),
232-
("zfhmin", Some(sym::riscv_target_feature)),
233240
("zba", Some(sym::riscv_target_feature)),
234241
("zbb", Some(sym::riscv_target_feature)),
235242
("zbc", Some(sym::riscv_target_feature)),
236-
("zbs", Some(sym::riscv_target_feature)),
237243
("zbkb", Some(sym::riscv_target_feature)),
238244
("zbkc", Some(sym::riscv_target_feature)),
239245
("zbkx", Some(sym::riscv_target_feature)),
246+
("zbs", Some(sym::riscv_target_feature)),
247+
("zdinx", Some(sym::riscv_target_feature)),
248+
("zfh", Some(sym::riscv_target_feature)),
249+
("zfhmin", Some(sym::riscv_target_feature)),
250+
("zfinx", Some(sym::riscv_target_feature)),
251+
("zhinx", Some(sym::riscv_target_feature)),
252+
("zhinxmin", Some(sym::riscv_target_feature)),
253+
("zk", Some(sym::riscv_target_feature)),
254+
("zkn", Some(sym::riscv_target_feature)),
240255
("zknd", Some(sym::riscv_target_feature)),
241256
("zkne", Some(sym::riscv_target_feature)),
242257
("zknh", Some(sym::riscv_target_feature)),
243-
("zksed", Some(sym::riscv_target_feature)),
244-
("zksh", Some(sym::riscv_target_feature)),
245258
("zkr", Some(sym::riscv_target_feature)),
246-
("zkn", Some(sym::riscv_target_feature)),
247259
("zks", Some(sym::riscv_target_feature)),
248-
("zk", Some(sym::riscv_target_feature)),
260+
("zksed", Some(sym::riscv_target_feature)),
261+
("zksh", Some(sym::riscv_target_feature)),
249262
("zkt", Some(sym::riscv_target_feature)),
263+
// tidy-alphabetical-end
250264
];
251265

252266
const WASM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
253-
("simd128", None),
267+
// tidy-alphabetical-start
254268
("atomics", Some(sym::wasm_target_feature)),
255-
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
256269
("bulk-memory", Some(sym::wasm_target_feature)),
257270
("mutable-globals", Some(sym::wasm_target_feature)),
271+
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
258272
("reference-types", Some(sym::wasm_target_feature)),
259273
("sign-ext", Some(sym::wasm_target_feature)),
274+
("simd128", None),
275+
// tidy-alphabetical-end
260276
];
261277

262278
const BPF_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[("alu32", Some(sym::bpf_target_feature))];

library/std/src/io/error.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub enum ErrorKind {
387387
impl ErrorKind {
388388
pub(crate) fn as_str(&self) -> &'static str {
389389
use ErrorKind::*;
390-
// Strictly alphabetical, please. (Sadly rustfmt cannot do this yet.)
390+
// tidy-alphabetical-start
391391
match *self {
392392
AddrInUse => "address in use",
393393
AddrNotAvailable => "address not available",
@@ -431,6 +431,7 @@ impl ErrorKind {
431431
WouldBlock => "operation would block",
432432
WriteZero => "write zero",
433433
}
434+
// tidy-alphabetical-end
434435
}
435436
}
436437

0 commit comments

Comments
 (0)