Parse and allow const use closures

This commit is contained in:
Santiago Pastorino
2025-02-21 17:38:30 -03:00
parent 4e6407ab94
commit 65d65e5e7e
2 changed files with 14 additions and 3 deletions

View File

@@ -813,9 +813,9 @@ impl<'a> Parser<'a> {
self.is_keyword_ahead(0, &[kw::Const])
&& self.look_ahead(1, |t| match &t.kind {
// async closures do not work with const closures, so we do not parse that here.
token::Ident(kw::Move | kw::Static, IdentIsRaw::No) | token::OrOr | token::Or => {
true
}
token::Ident(kw::Move | kw::Use | kw::Static, IdentIsRaw::No)
| token::OrOr
| token::Or => true,
_ => false,
})
}