about summary refs log tree commit diff
path: root/src
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 /src
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 'src')
-rw-r--r--src/librustdoc/clean/types.rs3
-rw-r--r--src/tools/tidy/src/alphabetical.rs10
-rw-r--r--src/tools/tidy/src/main.rs2
3 files changed, 8 insertions, 7 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 7e053380069..4c130b2ffec 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -2540,7 +2540,7 @@ impl SubstParam {
 mod size_asserts {
     use super::*;
     use rustc_data_structures::static_assert_size;
-    // These are in alphabetical order, which is easy to maintain.
+    // tidy-alphabetical-start
     static_assert_size!(Crate, 72); // frequently moved by-value
     static_assert_size!(DocFragment, 32);
     static_assert_size!(GenericArg, 48);
@@ -2550,4 +2550,5 @@ mod size_asserts {
     static_assert_size!(ItemKind, 88);
     static_assert_size!(PathSegment, 40);
     static_assert_size!(Type, 48);
+    // tidy-alphabetical-end
 }
diff --git a/src/tools/tidy/src/alphabetical.rs b/src/tools/tidy/src/alphabetical.rs
index c9f1dfb707f..f913f6cde38 100644
--- a/src/tools/tidy/src/alphabetical.rs
+++ b/src/tools/tidy/src/alphabetical.rs
@@ -29,7 +29,8 @@ fn is_close_bracket(c: char) -> bool {
     matches!(c, ')' | ']' | '}')
 }
 
-const START_COMMENT: &str = "// tidy-alphabetical-start";
+// Don't let tidy check this here :D
+const START_COMMENT: &str = concat!("// tidy-alphabetical", "-start");
 const END_COMMENT: &str = "// tidy-alphabetical-end";
 
 fn check_section<'a>(
@@ -47,7 +48,7 @@ fn check_section<'a>(
         if line.contains(START_COMMENT) {
             tidy_error!(
                 bad,
-                "{file}:{} found `// tidy-alphabetical-start` expecting `// tidy-alphabetical-end`",
+                "{file}:{} found `{START_COMMENT}` expecting `{END_COMMENT}`",
                 line_idx
             )
         }
@@ -102,10 +103,7 @@ pub fn check(path: &Path, bad: &mut bool) {
             if line.contains(START_COMMENT) {
                 check_section(file, &mut lines, bad);
                 if lines.peek().is_none() {
-                    tidy_error!(
-                        bad,
-                        "{file}: reached end of file expecting `// tidy-alphabetical-end`"
-                    )
+                    tidy_error!(bad, "{file}: reached end of file expecting `{END_COMMENT}`")
                 }
             }
         }
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index 8fe361c45a2..ca785042aaa 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -90,7 +90,9 @@ fn main() {
         check!(edition, &compiler_path);
         check!(edition, &library_path);
 
+        check!(alphabetical, &src_path);
         check!(alphabetical, &compiler_path);
+        check!(alphabetical, &library_path);
 
         let collected = {
             while handles.len() >= concurrency.get() {