diff options
| author | Ralf Jung <post@ralfj.de> | 2023-01-13 11:46:54 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-01-13 11:46:54 +0100 |
| commit | 9475277c235d2297dc446155325b0b3fcfdbf722 (patch) | |
| tree | bf243b402462c46038a1692d4ab52a7148b75d52 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 9742679ebed966c62bf457df8353b9a5c6c22d29 (diff) | |
| parent | 7d59c0ccaa3aeb528a66ae3d2fec6a5ebbe44bc2 (diff) | |
| download | rust-9475277c235d2297dc446155325b0b3fcfdbf722.tar.gz rust-9475277c235d2297dc446155325b0b3fcfdbf722.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 9f436783ced..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() @@ -2039,7 +2042,7 @@ impl<'a> Parser<'a> { }); } - let (attrs, blk) = self.parse_block_common(lo, blk_mode)?; + let (attrs, blk) = self.parse_block_common(lo, blk_mode, true)?; Ok(self.mk_expr_with_attrs(blk.span, ExprKind::Block(blk, opt_label), attrs)) } @@ -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, |
