1 // Copyright 2017 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.
23 static STATIC: () = ();
28 let doesnt_matter = 0;
31 UnitStruct => {} // OK, `UnitStruct` is a unit struct pattern
34 TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs
37 BracedStruct => {} // OK, `BracedStruct` is a fresh binding
40 UnitVariant => {} // OK, `UnitVariant` is a unit variant pattern
43 TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants
46 BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants
49 CONST => {} // OK, `CONST` is a const pattern
52 STATIC => {} //~ ERROR match bindings cannot shadow statics
55 function => {} // OK, `function` is a fresh binding
58 let UnitStruct = UnitStruct; // OK, `UnitStruct` is a unit struct pattern
59 let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs
60 let BracedStruct = doesnt_matter; // OK, `BracedStruct` is a fresh binding
61 let UnitVariant = UnitVariant; // OK, `UnitVariant` is a unit variant pattern
62 let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants
63 let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants
64 let CONST = CONST; // OK, `CONST` is a const pattern
65 let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics
66 let function = doesnt_matter; // OK, `function` is a fresh binding