From 7054fe309445d6c9275b87a40ba2122b321b5a31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 23 Jul 2017 16:20:14 +0300 Subject: Lambda expressions honor no struct literal restriction --- .../struct-literal-restrictions-in-lamda.rs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/parse-fail/struct-literal-restrictions-in-lamda.rs (limited to 'src/test/parse-fail') 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 or the MIT license +// , 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"); + } +} -- cgit 1.4.1-3-g733a5