about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-31 23:26:47 +0000
committerbors <bors@rust-lang.org>2017-08-31 23:26:47 +0000
commit69dbe6602ddc32dad1febb65232c999dd9980ead (patch)
treee4766f3114bc7f60d01489fc6621039feded8323 /src/libsyntax/parse
parent97b01abf3d222523d0db4f79c13ed45e7fef27e3 (diff)
parent7054fe309445d6c9275b87a40ba2122b321b5a31 (diff)
downloadrust-69dbe6602ddc32dad1febb65232c999dd9980ead.tar.gz
rust-69dbe6602ddc32dad1febb65232c999dd9980ead.zip
Auto merge of #43425 - matklad:lambda-restrictions, r=eddyb
Lambda expressions honor no struct literal restriction

This is a fix for #43412 if we decide that it is indeed a bug :)

closes #43412
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5e05f36345f..d08373334f1 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3025,7 +3025,10 @@ impl<'a> Parser<'a> {
         let decl = self.parse_fn_block_decl()?;
         let decl_hi = self.prev_span;
         let body = match decl.output {
-            FunctionRetTy::Default(_) => self.parse_expr()?,
+            FunctionRetTy::Default(_) => {
+                let restrictions = self.restrictions - RESTRICTION_STMT_EXPR;
+                self.parse_expr_res(restrictions, None)?
+            },
             _ => {
                 // If an explicit return type is given, require a
                 // block to appear (RFC 968).