From a61cf673cd10ed24394c3403e03d8f7cf1f50170 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 5 Oct 2023 11:30:55 +0000 Subject: Reserve `gen` keyword for `gen {}` blocks and `gen fn` in 2024 edition --- compiler/rustc_span/src/symbol.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_span/src') diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ff61143a12b..8ef16ed0dbf 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -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 { -- cgit 1.4.1-3-g733a5