Skip to content

Commit 981401c

Browse files
committed
Move gen 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). Also, the cases in `is_unused_keyword_conditional` should be in alphabetical order, to match the keyword list. These changes don't affect the behaviour of any of the `Symbol::is_*` functions.
1 parent 6e1259c commit 981401c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_span/src/symbol.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ 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

9394
// Special lifetime names
@@ -99,7 +100,6 @@ symbols! {
99100
Builtin: "builtin",
100101
Catch: "catch",
101102
Default: "default",
102-
Gen: "gen",
103103
MacroRules: "macro_rules",
104104
Raw: "raw",
105105
Reuse: "reuse",
@@ -2610,8 +2610,8 @@ impl Symbol {
26102610
}
26112611

26122612
fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
2613-
self == kw::Try && edition().at_least_rust_2018()
2614-
|| self == kw::Gen && edition().at_least_rust_2024()
2613+
self == kw::Gen && edition().at_least_rust_2024()
2614+
|| self == kw::Try && edition().at_least_rust_2018()
26152615
}
26162616

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

0 commit comments

Comments
 (0)