Skip to content

Commit 5791fd7

Browse files
committed
Alphabetize the keywords list.
1 parent 4bb7fb1 commit 5791fd7

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

compiler/rustc_span/src/symbol.rs

+20-7
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,22 @@ symbols! {
2727
// (e.g. `_`).
2828
//
2929
// If you modify this list, adjust any relevant `Symbol::{is,can_be}_*`
30-
// predicates and `used_keywords`. (This should rarely be necessary if
31-
// the keywords are kept in alphabetic order.) Also consider adding new
32-
// keywords to the `ui/parser/raw/raw-idents.rs` test.
30+
// predicates and `used_keywords`. Also consider adding new keywords to the
31+
// `ui/parser/raw/raw-idents.rs` test.
3332
Keywords {
3433
// Special reserved identifiers used internally for elided lifetimes,
3534
// unnamed method parameters, crate root module, error recovery etc.
3635
// Matching predicates: `is_special`/`is_reserved`
36+
// tidy-alphabetical-start
37+
DollarCrate: "$crate",
3738
Empty: "",
3839
PathRoot: "{{root}}",
39-
DollarCrate: "$crate",
4040
Underscore: "_",
41+
// tidy-alphabetical-end
4142

4243
// Keywords that are used in stable Rust.
4344
// Matching predicates: `is_used_keyword_always`/`is_reserved`
45+
// tidy-alphabetical-start
4446
As: "as",
4547
Break: "break",
4648
Const: "const",
@@ -76,9 +78,11 @@ symbols! {
7678
Use: "use",
7779
Where: "where",
7880
While: "while",
81+
// tidy-alphabetical-end
7982

8083
// Keywords that are used in unstable Rust or reserved for future use.
8184
// Matching predicates: `is_unused_keyword_always`/`is_reserved`
85+
// tidy-alphabetical-start
8286
Abstract: "abstract",
8387
Become: "become",
8488
Box: "box",
@@ -91,39 +95,48 @@ symbols! {
9195
Unsized: "unsized",
9296
Virtual: "virtual",
9397
Yield: "yield",
98+
// tidy-alphabetical-end
9499

95100
// Edition-specific keywords that are used in stable Rust.
96101
// Matching predicates: `is_used_keyword_conditional`/`is_reserved` (if
97102
// the edition suffices)
103+
// tidy-alphabetical-start
98104
Async: "async", // >= 2018 Edition only
99105
Await: "await", // >= 2018 Edition only
100106
Dyn: "dyn", // >= 2018 Edition only
107+
// tidy-alphabetical-end
101108

102109
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
103110
// Matching predicates: `is_unused_keyword_conditional`/`is_reserved` (if
104111
// the edition suffices)
112+
// tidy-alphabetical-start
105113
Gen: "gen", // >= 2024 Edition only
106114
Try: "try", // >= 2018 Edition only
115+
// tidy-alphabetical-end
107116

108117
// "Lifetime keywords": regular keywords with a leading `'`.
109118
// Matching predicates: none
110-
UnderscoreLifetime: "'_",
119+
// tidy-alphabetical-start
111120
StaticLifetime: "'static",
121+
UnderscoreLifetime: "'_",
122+
// tidy-alphabetical-end
112123

113124
// Weak keywords, have special meaning only in specific contexts.
114125
// Matching predicates: none
126+
// tidy-alphabetical-start
115127
Auto: "auto",
116128
Builtin: "builtin",
117129
Catch: "catch",
130+
ContractEnsures: "contract_ensures",
131+
ContractRequires: "contract_requires",
118132
Default: "default",
119133
MacroRules: "macro_rules",
120134
Raw: "raw",
121135
Reuse: "reuse",
122-
ContractEnsures: "contract_ensures",
123-
ContractRequires: "contract_requires",
124136
Safe: "safe",
125137
Union: "union",
126138
Yeet: "yeet",
139+
// tidy-alphabetical-end
127140
}
128141

129142
// Pre-interned symbols that can be referred to with `rustc_span::sym::*`.

0 commit comments

Comments
 (0)