Skip to content

Commit 02d99ea

Browse files
committed
Parse and allow const use closures
1 parent e2ff121 commit 02d99ea

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ impl<'a> Parser<'a> {
812812
self.is_keyword_ahead(0, &[kw::Const])
813813
&& self.look_ahead(1, |t| match &t.kind {
814814
// async closures do not work with const closures, so we do not parse that here.
815-
token::Ident(kw::Move | kw::Static, IdentIsRaw::No)
815+
token::Ident(kw::Move | kw::Use | kw::Static, IdentIsRaw::No)
816816
| token::OrOr
817817
| token::BinOp(token::Or) => true,
818818
_ => false,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ check-pass
2+
3+
#![feature(const_closures)]
4+
#![feature(ergonomic_clones)]
5+
#![allow(incomplete_features)]
6+
7+
const fn foo() {
8+
let cl = const use || {};
9+
}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)