Reserve gen
keyword for gen {}
blocks and gen fn
in 2024 edition
This commit is contained in:
parent
ccb160d343
commit
a61cf673cd
14 changed files with 138 additions and 4 deletions
|
@ -11,6 +11,7 @@ mod stmt;
|
|||
mod ty;
|
||||
|
||||
use crate::lexer::UnmatchedDelim;
|
||||
use ast::Gen;
|
||||
pub use attr_wrapper::AttrWrapper;
|
||||
pub use diagnostics::AttemptLocalParseRecovery;
|
||||
pub(crate) use expr::ForbiddenLetReason;
|
||||
|
@ -1126,6 +1127,16 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Parses genness: `gen` or nothing.
|
||||
fn parse_genness(&mut self, case: Case) -> Gen {
|
||||
if self.token.span.at_least_rust_2024() && self.eat_keyword_case(kw::Gen, case) {
|
||||
let span = self.prev_token.uninterpolated_span();
|
||||
Gen::Yes { span, closure_id: DUMMY_NODE_ID, return_impl_trait_id: DUMMY_NODE_ID }
|
||||
} else {
|
||||
Gen::No
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses unsafety: `unsafe` or nothing.
|
||||
fn parse_unsafety(&mut self, case: Case) -> Unsafe {
|
||||
if self.eat_keyword_case(kw::Unsafe, case) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue