Skip to content

Commit e96cd6c

Browse files
committed
Move gen and 'static in the keyword list.
- `gen` is an edition-specific keyword used in unstable Rust, and so belongs with `try` (as `is_unused_keyword_conditional` indicates). - `'static` is a weak keyword according to the Reference and the Ferrocene spec, and so belongs with the other weak keywords. - The cases in `is_unused_keyword_conditional` should be in alphabetical order, to match the keyword list. None of these changes affect the behaviour of any of the `Symbol::is_*` functions.
1 parent 8992db0 commit e96cd6c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/rustc_span/src/symbol.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,19 @@ symbols! {
8888
Dyn: "dyn", // >= 2018 Edition only
8989

9090
// Edition-specific keywords that are used in unstable Rust or reserved for future use.
91+
Gen: "gen", // >= 2024 Edition only
9192
Try: "try", // >= 2018 Edition only
9293

93-
// Special lifetime names
94-
StaticLifetime: "'static",
95-
9694
// Weak keywords, have special meaning only in specific contexts.
9795
Auto: "auto",
9896
Builtin: "builtin",
9997
Catch: "catch",
10098
Default: "default",
101-
Gen: "gen",
10299
MacroRules: "macro_rules",
103100
Raw: "raw",
104101
Reuse: "reuse",
105102
Safe: "safe",
103+
StaticLifetime: "'static",
106104
Union: "union",
107105
Yeet: "yeet",
108106
}
@@ -2608,8 +2606,8 @@ impl Symbol {
26082606
}
26092607

26102608
fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
2611-
self == kw::Try && edition().at_least_rust_2018()
2612-
|| self == kw::Gen && edition().at_least_rust_2024()
2609+
self == kw::Gen && edition().at_least_rust_2024()
2610+
|| self == kw::Try && edition().at_least_rust_2018()
26132611
}
26142612

26152613
pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool {

0 commit comments

Comments
 (0)