about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-12-13 13:43:47 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-12-18 20:21:03 +1100
commited5b91abc8591fbbc4337cc14b484eb3ed5a2955 (patch)
tree75383894e4eb235d3eb29e8552475609c127e9df /compiler/rustc_span/src
parent1564318482e80152d43150fdfc3ade2c868f2677 (diff)
downloadrust-ed5b91abc8591fbbc4337cc14b484eb3ed5a2955.tar.gz
rust-ed5b91abc8591fbbc4337cc14b484eb3ed5a2955.zip
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.
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/symbol.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index d2391f30168..11441854a76 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -88,6 +88,7 @@ symbols! {
         Dyn:                "dyn", // >= 2018 Edition only
 
         // Edition-specific keywords that are used in unstable Rust or reserved for future use.
+        Gen:                "gen", // >= 2024 Edition only
         Try:                "try", // >= 2018 Edition only
 
         // Special lifetime names
@@ -99,7 +100,6 @@ symbols! {
         Builtin:            "builtin",
         Catch:              "catch",
         Default:            "default",
-        Gen:                "gen",
         MacroRules:         "macro_rules",
         Raw:                "raw",
         Reuse:              "reuse",
@@ -2611,8 +2611,8 @@ impl Symbol {
     }
 
     fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
-        self == kw::Try && edition().at_least_rust_2018()
-            || self == kw::Gen && edition().at_least_rust_2024()
+        self == kw::Gen && edition().at_least_rust_2024()
+            || self == kw::Try && edition().at_least_rust_2018()
     }
 
     pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool {