Parse and allow const use closures
This commit is contained in:
parent
4e6407ab94
commit
65d65e5e7e
2 changed files with 14 additions and 3 deletions
|
@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
11
tests/ui/ergonomic-clones/closure/const-closure.rs
Normal file
11
tests/ui/ergonomic-clones/closure/const-closure.rs
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue