1
Fork 0

Reserve gen keyword for gen {} blocks and gen fn in 2024 edition

This commit is contained in:
Oli Scherer 2023-10-05 11:30:55 +00:00
parent ccb160d343
commit a61cf673cd
14 changed files with 138 additions and 4 deletions

View file

@ -98,6 +98,7 @@ symbols! {
Builtin: "builtin",
Catch: "catch",
Default: "default",
Gen: "gen",
MacroRules: "macro_rules",
Raw: "raw",
Union: "union",
@ -2188,8 +2189,9 @@ impl Symbol {
self >= kw::Abstract && self <= kw::Yield
}
fn is_unused_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool {
self == kw::Try && edition() >= Edition::Edition2018
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()
}
pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool {