Skip to content

Commit

Permalink
Move gen in the keyword list.
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
nnethercote committed Dec 18, 2024
1 parent 1564318 commit ed5b91a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -99,7 +100,6 @@ symbols! {
Builtin: "builtin",
Catch: "catch",
Default: "default",
Gen: "gen",
MacroRules: "macro_rules",
Raw: "raw",
Reuse: "reuse",
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ed5b91a

Please sign in to comment.