Skip to content

Commit 1571111

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 a71bdf9 + 13e2caa commit 1571111

File tree

2 files changed

+50
-39
lines changed

2 files changed

+50
-39
lines changed

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

std/tests/run-time-detect.rs

+48-38
Original file line numberDiff line numberDiff line change
@@ -14,77 +14,85 @@
1414
#[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))]
1515
fn arm_linux() {
1616
use std::arch::is_arm_feature_detected;
17+
// tidy-alphabetical-start
18+
println!("aes: {}", is_arm_feature_detected!("aes"));
19+
println!("crc: {}", is_arm_feature_detected!("crc"));
20+
println!("crypto: {}", is_arm_feature_detected!("crypto"));
1721
println!("neon: {}", is_arm_feature_detected!("neon"));
1822
println!("pmull: {}", is_arm_feature_detected!("pmull"));
19-
println!("crypto: {}", is_arm_feature_detected!("crypto"));
20-
println!("crc: {}", is_arm_feature_detected!("crc"));
21-
println!("aes: {}", is_arm_feature_detected!("aes"));
2223
println!("sha2: {}", is_arm_feature_detected!("sha2"));
24+
// tidy-alphabetical-end
2325
}
2426

2527
#[test]
2628
#[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
2729
fn aarch64_linux() {
2830
use std::arch::is_aarch64_feature_detected;
29-
println!("neon: {}", is_aarch64_feature_detected!("neon"));
31+
// tidy-alphabetical-start
32+
println!("aes: {}", is_aarch64_feature_detected!("aes"));
3033
println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
31-
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
32-
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
33-
println!("sve: {}", is_aarch64_feature_detected!("sve"));
34+
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
35+
println!("bti: {}", is_aarch64_feature_detected!("bti"));
3436
println!("crc: {}", is_aarch64_feature_detected!("crc"));
35-
println!("lse: {}", is_aarch64_feature_detected!("lse"));
36-
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
37-
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
38-
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
39-
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
37+
println!("dit: {}", is_aarch64_feature_detected!("dit"));
4038
println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
41-
println!("tme: {}", is_aarch64_feature_detected!("tme"));
39+
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
40+
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
41+
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
42+
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
43+
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
4244
println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
43-
println!("dit: {}", is_aarch64_feature_detected!("dit"));
4445
println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
45-
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
46-
println!("sb: {}", is_aarch64_feature_detected!("sb"));
47-
println!("paca: {}", is_aarch64_feature_detected!("paca"));
48-
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
49-
println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
50-
println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
51-
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
52-
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
53-
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
54-
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
55-
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
46+
println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
5647
println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
5748
println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
58-
println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
59-
println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
60-
println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
61-
println!("rand: {}", is_aarch64_feature_detected!("rand"));
62-
println!("bti: {}", is_aarch64_feature_detected!("bti"));
63-
println!("mte: {}", is_aarch64_feature_detected!("mte"));
6449
println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
65-
println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
66-
println!("aes: {}", is_aarch64_feature_detected!("aes"));
50+
println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
51+
println!("lse: {}", is_aarch64_feature_detected!("lse"));
52+
println!("mte: {}", is_aarch64_feature_detected!("mte"));
53+
println!("neon: {}", is_aarch64_feature_detected!("neon"));
54+
println!("paca: {}", is_aarch64_feature_detected!("paca"));
55+
println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
56+
println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
57+
println!("rand: {}", is_aarch64_feature_detected!("rand"));
58+
println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
59+
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
60+
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
61+
println!("sb: {}", is_aarch64_feature_detected!("sb"));
6762
println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
6863
println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
6964
println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
65+
println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
66+
println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
67+
println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
68+
println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
69+
println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
70+
println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
71+
println!("sve: {}", is_aarch64_feature_detected!("sve"));
72+
println!("tme: {}", is_aarch64_feature_detected!("tme"));
73+
// tidy-alphabetical-end
7074
}
7175

7276
#[test]
7377
#[cfg(all(target_arch = "powerpc", target_os = "linux"))]
7478
fn powerpc_linux() {
7579
use std::arch::is_powerpc_feature_detected;
80+
// tidy-alphabetical-start
7681
println!("altivec: {}", is_powerpc_feature_detected!("altivec"));
77-
println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
7882
println!("power8: {}", is_powerpc_feature_detected!("power8"));
83+
println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
84+
// tidy-alphabetical-end
7985
}
8086

8187
#[test]
8288
#[cfg(all(target_arch = "powerpc64", target_os = "linux"))]
8389
fn powerpc64_linux() {
8490
use std::arch::is_powerpc64_feature_detected;
91+
// tidy-alphabetical-start
8592
println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
86-
println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
8793
println!("power8: {}", is_powerpc64_feature_detected!("power8"));
94+
println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
95+
// tidy-alphabetical-end
8896
}
8997

9098
#[test]
@@ -102,9 +110,9 @@ fn x86_all() {
102110
// the below is in alphabetical order and matches
103111
// the order of X86_ALLOWED_FEATURES in rustc_codegen_ssa's target_features.rs
104112

113+
// tidy-alphabetical-start
105114
println!("adx: {:?}", is_x86_feature_detected!("adx"));
106115
println!("aes: {:?}", is_x86_feature_detected!("aes"));
107-
println!("avx: {:?}", is_x86_feature_detected!("avx"));
108116
println!("avx2: {:?}", is_x86_feature_detected!("avx2"));
109117
println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16"));
110118
println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg"));
@@ -117,13 +125,14 @@ fn x86_all() {
117125
println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma"));
118126
println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf"));
119127
println!("avx512vaes: {:?}", is_x86_feature_detected!("avx512vaes"));
120-
println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
121128
println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2"));
129+
println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
122130
println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl"));
123131
println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni"));
124132
println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect"));
125133
println!("avx512vpclmulqdq: {:?}", is_x86_feature_detected!("avx512vpclmulqdq"));
126134
println!("avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq"));
135+
println!("avx: {:?}", is_x86_feature_detected!("avx"));
127136
println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
128137
println!("bmi2: {:?}", is_x86_feature_detected!("bmi2"));
129138
println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
@@ -138,16 +147,17 @@ fn x86_all() {
138147
println!("rdseed: {:?}", is_x86_feature_detected!("rdseed"));
139148
println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
140149
println!("sha: {:?}", is_x86_feature_detected!("sha"));
141-
println!("sse: {:?}", is_x86_feature_detected!("sse"));
142150
println!("sse2: {:?}", is_x86_feature_detected!("sse2"));
143151
println!("sse3: {:?}", is_x86_feature_detected!("sse3"));
144152
println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1"));
145153
println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2"));
146154
println!("sse4a: {:?}", is_x86_feature_detected!("sse4a"));
155+
println!("sse: {:?}", is_x86_feature_detected!("sse"));
147156
println!("ssse3: {:?}", is_x86_feature_detected!("ssse3"));
148157
println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
149158
println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
150159
println!("xsavec: {:?}", is_x86_feature_detected!("xsavec"));
151160
println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt"));
152161
println!("xsaves: {:?}", is_x86_feature_detected!("xsaves"));
162+
// tidy-alphabetical-end
153163
}

0 commit comments

Comments
 (0)