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.
This commit is contained in:
Nicholas Nethercote 2024-12-13 13:43:47 +11:00
parent 1564318482
commit ed5b91abc8

View file

@ -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 {