about summary refs log tree commit diff
path: root/src/test/parse-fail
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/test/parse-fail
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/test/parse-fail')
-rw-r--r--src/test/parse-fail/struct-literal-restrictions-in-lamda.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/parse-fail/struct-literal-restrictions-in-lamda.rs b/src/test/parse-fail/struct-literal-restrictions-in-lamda.rs
new file mode 100644
index 00000000000..6b7a26556f4
--- /dev/null
+++ b/src/test/parse-fail/struct-literal-restrictions-in-lamda.rs
@@ -0,0 +1,29 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z parse-only
+
+struct Foo {
+    x: isize,
+}
+
+impl Foo {
+    fn hi(&self) -> bool {
+        true
+    }
+}
+
+fn main() {
+    while || Foo {
+        x: 3    //~ ERROR expected type, found `3`
+    }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{`
+        println!("yo");
+    }
+}