diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-12-20 16:15:55 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2023-01-12 02:28:37 +0000 |
| commit | 4fb10c0ce45673264d5dd428f4d5a4a389a2f1de (patch) | |
| tree | dc9a50af8976cda0bb65f9473c03bc3e1b32ee6f /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 56ee65aeb6d1fad67d903d5ee1359abcf7b94231 (diff) | |
| download | rust-4fb10c0ce45673264d5dd428f4d5a4a389a2f1de.tar.gz rust-4fb10c0ce45673264d5dd428f4d5a4a389a2f1de.zip | |
parse const closures
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index f5093fb02a8..dd2b03988c3 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1325,7 +1325,10 @@ impl<'a> Parser<'a> { self.parse_array_or_repeat_expr(Delimiter::Bracket) } else if self.check_path() { self.parse_path_start_expr() - } else if self.check_keyword(kw::Move) || self.check_keyword(kw::Static) { + } else if self.check_keyword(kw::Move) + || self.check_keyword(kw::Static) + || self.check_const_closure() + { self.parse_closure_expr() } else if self.eat_keyword(kw::If) { self.parse_if_expr() @@ -2065,6 +2068,8 @@ impl<'a> Parser<'a> { ClosureBinder::NotPresent }; + let constness = self.parse_constness(Case::Sensitive); + let movability = if self.eat_keyword(kw::Static) { Movability::Static } else { Movability::Movable }; @@ -2111,6 +2116,7 @@ impl<'a> Parser<'a> { ExprKind::Closure(Box::new(ast::Closure { binder, capture_clause, + constness, asyncness, movability, fn_decl, |
