about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-14 23:43:46 +0200
committerGitHub <noreply@github.com>2022-10-14 23:43:46 +0200
commita96f1a8a1eef38f024d6fcff932f55a2a760a395 (patch)
tree18f4def75c940c970bc4066bc560f76d32e508e6 /library/std
parent03a521b4fecf74d21278dab6a6034587da7b9dd9 (diff)
parentb00cb04037a4ace1e34887ca35568e6f0c1e807d (diff)
downloadrust-a96f1a8a1eef38f024d6fcff932f55a2a760a395.tar.gz
rust-a96f1a8a1eef38f024d6fcff932f55a2a760a395.zip
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.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/io/error.rs3
-rw-r--r--library/std/tests/run-time-detect.rs86
2 files changed, 50 insertions, 39 deletions
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index 837145bfaed..3cabf24492e 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -387,7 +387,7 @@ pub enum ErrorKind {
 impl ErrorKind {
     pub(crate) fn as_str(&self) -> &'static str {
         use ErrorKind::*;
-        // Strictly alphabetical, please.  (Sadly rustfmt cannot do this yet.)
+        // tidy-alphabetical-start
         match *self {
             AddrInUse => "address in use",
             AddrNotAvailable => "address not available",
@@ -431,6 +431,7 @@ impl ErrorKind {
             WouldBlock => "operation would block",
             WriteZero => "write zero",
         }
+        // tidy-alphabetical-end
     }
 }
 
diff --git a/library/std/tests/run-time-detect.rs b/library/std/tests/run-time-detect.rs
index a57a52d9bb0..02c076f1bb5 100644
--- a/library/std/tests/run-time-detect.rs
+++ b/library/std/tests/run-time-detect.rs
@@ -14,77 +14,85 @@
 #[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))]
 fn arm_linux() {
     use std::arch::is_arm_feature_detected;
+    // tidy-alphabetical-start
+    println!("aes: {}", is_arm_feature_detected!("aes"));
+    println!("crc: {}", is_arm_feature_detected!("crc"));
+    println!("crypto: {}", is_arm_feature_detected!("crypto"));
     println!("neon: {}", is_arm_feature_detected!("neon"));
     println!("pmull: {}", is_arm_feature_detected!("pmull"));
-    println!("crypto: {}", is_arm_feature_detected!("crypto"));
-    println!("crc: {}", is_arm_feature_detected!("crc"));
-    println!("aes: {}", is_arm_feature_detected!("aes"));
     println!("sha2: {}", is_arm_feature_detected!("sha2"));
+    // tidy-alphabetical-end
 }
 
 #[test]
 #[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
 fn aarch64_linux() {
     use std::arch::is_aarch64_feature_detected;
-    println!("neon: {}", is_aarch64_feature_detected!("neon"));
+    // tidy-alphabetical-start
+    println!("aes: {}", is_aarch64_feature_detected!("aes"));
     println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
-    println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
-    println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
-    println!("sve: {}", is_aarch64_feature_detected!("sve"));
+    println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
+    println!("bti: {}", is_aarch64_feature_detected!("bti"));
     println!("crc: {}", is_aarch64_feature_detected!("crc"));
-    println!("lse: {}", is_aarch64_feature_detected!("lse"));
-    println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
-    println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
-    println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
-    println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
+    println!("dit: {}", is_aarch64_feature_detected!("dit"));
     println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
-    println!("tme: {}", is_aarch64_feature_detected!("tme"));
+    println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
+    println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
+    println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
+    println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
+    println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
     println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
-    println!("dit: {}", is_aarch64_feature_detected!("dit"));
     println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
-    println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
-    println!("sb: {}", is_aarch64_feature_detected!("sb"));
-    println!("paca: {}", is_aarch64_feature_detected!("paca"));
-    println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
-    println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
-    println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
-    println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
-    println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
-    println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
-    println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
-    println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
+    println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
     println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
     println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
-    println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
-    println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
-    println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
-    println!("rand: {}", is_aarch64_feature_detected!("rand"));
-    println!("bti: {}", is_aarch64_feature_detected!("bti"));
-    println!("mte: {}", is_aarch64_feature_detected!("mte"));
     println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
-    println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
-    println!("aes: {}", is_aarch64_feature_detected!("aes"));
+    println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
+    println!("lse: {}", is_aarch64_feature_detected!("lse"));
+    println!("mte: {}", is_aarch64_feature_detected!("mte"));
+    println!("neon: {}", is_aarch64_feature_detected!("neon"));
+    println!("paca: {}", is_aarch64_feature_detected!("paca"));
+    println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
+    println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
+    println!("rand: {}", is_aarch64_feature_detected!("rand"));
+    println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
+    println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
+    println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
+    println!("sb: {}", is_aarch64_feature_detected!("sb"));
     println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
     println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
     println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
+    println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
+    println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
+    println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
+    println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
+    println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
+    println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
+    println!("sve: {}", is_aarch64_feature_detected!("sve"));
+    println!("tme: {}", is_aarch64_feature_detected!("tme"));
+    // tidy-alphabetical-end
 }
 
 #[test]
 #[cfg(all(target_arch = "powerpc", target_os = "linux"))]
 fn powerpc_linux() {
     use std::arch::is_powerpc_feature_detected;
+    // tidy-alphabetical-start
     println!("altivec: {}", is_powerpc_feature_detected!("altivec"));
-    println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
     println!("power8: {}", is_powerpc_feature_detected!("power8"));
+    println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
+    // tidy-alphabetical-end
 }
 
 #[test]
 #[cfg(all(target_arch = "powerpc64", target_os = "linux"))]
 fn powerpc64_linux() {
     use std::arch::is_powerpc64_feature_detected;
+    // tidy-alphabetical-start
     println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
-    println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
     println!("power8: {}", is_powerpc64_feature_detected!("power8"));
+    println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
+    // tidy-alphabetical-end
 }
 
 #[test]
@@ -102,9 +110,9 @@ fn x86_all() {
     // the below is in alphabetical order and matches
     // the order of X86_ALLOWED_FEATURES in rustc_codegen_ssa's target_features.rs
 
+    // tidy-alphabetical-start
     println!("adx: {:?}", is_x86_feature_detected!("adx"));
     println!("aes: {:?}", is_x86_feature_detected!("aes"));
-    println!("avx: {:?}", is_x86_feature_detected!("avx"));
     println!("avx2: {:?}", is_x86_feature_detected!("avx2"));
     println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16"));
     println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg"));
@@ -117,13 +125,14 @@ fn x86_all() {
     println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma"));
     println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf"));
     println!("avx512vaes: {:?}", is_x86_feature_detected!("avx512vaes"));
-    println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
     println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2"));
+    println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
     println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl"));
     println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni"));
     println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect"));
     println!("avx512vpclmulqdq: {:?}", is_x86_feature_detected!("avx512vpclmulqdq"));
     println!("avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq"));
+    println!("avx: {:?}", is_x86_feature_detected!("avx"));
     println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
     println!("bmi2: {:?}", is_x86_feature_detected!("bmi2"));
     println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
@@ -138,16 +147,17 @@ fn x86_all() {
     println!("rdseed: {:?}", is_x86_feature_detected!("rdseed"));
     println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
     println!("sha: {:?}", is_x86_feature_detected!("sha"));
-    println!("sse: {:?}", is_x86_feature_detected!("sse"));
     println!("sse2: {:?}", is_x86_feature_detected!("sse2"));
     println!("sse3: {:?}", is_x86_feature_detected!("sse3"));
     println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1"));
     println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2"));
     println!("sse4a: {:?}", is_x86_feature_detected!("sse4a"));
+    println!("sse: {:?}", is_x86_feature_detected!("sse"));
     println!("ssse3: {:?}", is_x86_feature_detected!("ssse3"));
     println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
     println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
     println!("xsavec: {:?}", is_x86_feature_detected!("xsavec"));
     println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt"));
     println!("xsaves: {:?}", is_x86_feature_detected!("xsaves"));
+    // tidy-alphabetical-end
 }