@@ -27,9 +27,8 @@ symbols! {
27
27
// (e.g. `_`).
28
28
//
29
29
// 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.
33
32
Keywords {
34
33
// Special reserved identifiers used internally for elided lifetimes,
35
34
// unnamed method parameters, crate root module, error recovery etc.
@@ -43,13 +42,16 @@ symbols! {
43
42
// present, it's better to use `sym::dummy` than `kw::Empty`, because
44
43
// it's clearer that it's intended as a dummy value, and more likely
45
44
// to be detected if it accidentally does get used.
45
+ // tidy-alphabetical-start
46
+ DollarCrate : "$crate" ,
46
47
Empty : "" ,
47
48
PathRoot : "{{root}}" ,
48
- DollarCrate : "$crate" ,
49
49
Underscore : "_" ,
50
+ // tidy-alphabetical-end
50
51
51
52
// Keywords that are used in stable Rust.
52
53
// Matching predicates: `is_used_keyword_always`/`is_reserved`
54
+ // tidy-alphabetical-start
53
55
As : "as" ,
54
56
Break : "break" ,
55
57
Const : "const" ,
@@ -85,9 +87,11 @@ symbols! {
85
87
Use : "use" ,
86
88
Where : "where" ,
87
89
While : "while" ,
90
+ // tidy-alphabetical-end
88
91
89
92
// Keywords that are used in unstable Rust or reserved for future use.
90
93
// Matching predicates: `is_unused_keyword_always`/`is_reserved`
94
+ // tidy-alphabetical-start
91
95
Abstract : "abstract" ,
92
96
Become : "become" ,
93
97
Box : "box" ,
@@ -100,39 +104,48 @@ symbols! {
100
104
Unsized : "unsized" ,
101
105
Virtual : "virtual" ,
102
106
Yield : "yield" ,
107
+ // tidy-alphabetical-end
103
108
104
109
// Edition-specific keywords that are used in stable Rust.
105
110
// Matching predicates: `is_used_keyword_conditional`/`is_reserved` (if
106
111
// the edition suffices)
112
+ // tidy-alphabetical-start
107
113
Async : "async" , // >= 2018 Edition only
108
114
Await : "await" , // >= 2018 Edition only
109
115
Dyn : "dyn" , // >= 2018 Edition only
116
+ // tidy-alphabetical-end
110
117
111
118
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
112
119
// Matching predicates: `is_unused_keyword_conditional`/`is_reserved` (if
113
120
// the edition suffices)
121
+ // tidy-alphabetical-start
114
122
Gen : "gen" , // >= 2024 Edition only
115
123
Try : "try" , // >= 2018 Edition only
124
+ // tidy-alphabetical-end
116
125
117
126
// "Lifetime keywords": regular keywords with a leading `'`.
118
127
// Matching predicates: none
119
- UnderscoreLifetime : "'_" ,
128
+ // tidy-alphabetical-start
120
129
StaticLifetime : "'static" ,
130
+ UnderscoreLifetime : "'_" ,
131
+ // tidy-alphabetical-end
121
132
122
133
// Weak keywords, have special meaning only in specific contexts.
123
134
// Matching predicates: none
135
+ // tidy-alphabetical-start
124
136
Auto : "auto" ,
125
137
Builtin : "builtin" ,
126
138
Catch : "catch" ,
139
+ ContractEnsures : "contract_ensures" ,
140
+ ContractRequires : "contract_requires" ,
127
141
Default : "default" ,
128
142
MacroRules : "macro_rules" ,
129
143
Raw : "raw" ,
130
144
Reuse : "reuse" ,
131
- ContractEnsures : "contract_ensures" ,
132
- ContractRequires : "contract_requires" ,
133
145
Safe : "safe" ,
134
146
Union : "union" ,
135
147
Yeet : "yeet" ,
148
+ // tidy-alphabetical-end
136
149
}
137
150
138
151
// Pre-interned symbols that can be referred to with `rustc_span::sym::*`.
@@ -2781,7 +2794,7 @@ impl Ident {
2781
2794
/// *Note:* Please update this if a new keyword is added beyond the current
2782
2795
/// range.
2783
2796
pub fn used_keywords ( edition : impl Copy + FnOnce ( ) -> Edition ) -> Vec < Symbol > {
2784
- ( kw:: Empty . as_u32 ( ) ..kw:: Yeet . as_u32 ( ) )
2797
+ ( kw:: DollarCrate . as_u32 ( ) ..kw:: Yeet . as_u32 ( ) )
2785
2798
. filter_map ( |kw| {
2786
2799
let kw = Symbol :: new ( kw) ;
2787
2800
if kw. is_used_keyword_always ( ) || kw. is_used_keyword_conditional ( edition) {
0 commit comments