1
Fork 0

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
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
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.is_keyword_ahead(0, &[kw::Const])
&& self.look_ahead(1, |t| match &t.kind { && self.look_ahead(1, |t| match &t.kind {
// async closures do not work with const closures, so we do not parse that here. // 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 => { token::Ident(kw::Move | kw::Use | kw::Static, IdentIsRaw::No)
true | token::OrOr
} | token::Or => true,
_ => false, _ => false,
}) })
} }

View file

@ -0,0 +1,11 @@
//@ check-pass
#![feature(const_closures)]
#![feature(ergonomic_clones)]
#![allow(incomplete_features)]
const fn foo() {
let cl = const use || {};
}
fn main() {}