1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // compile-flags: --crate-type=lib
13 // A bunch of tests for syntactic forms involving blocks that were
14 // previously ambiguous (e.g. 'if true { } *val;' gets parsed as a
20 fn test1() { let val = &0; { } *val; }
22 fn test2() -> isize { let val = &0; { } *val }
24 #[derive(Copy, Clone)]
25 struct S { eax: isize }
28 let regs = &Cell::new(S {eax: 0});
29 match true { true => { } _ => { } }
33 fn test4() -> bool { let regs = &true; if true { } *regs || false }
35 fn test5() -> (isize, isize) { { } (0, 1) }
37 fn test6() -> bool { { } (true || false) && true }
41 match true { true => { } _ => { } }
59 let regs = &Cell::new(0);
60 match true { true => { } _ => { } } regs.set(regs.get() + 1);
63 fn test10() -> isize {
65 match true { true => { } _ => { } }
69 fn test11() -> Vec<isize> { if true { } vec!(1, 2) }