1 // Copyright 2014 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 // pretty-expanded FIXME #23616
13 struct MyStruct { field: usize }
14 struct Nested { nested: MyStruct }
15 struct Mix2 { nested: ((usize,),) }
17 const STRUCT: MyStruct = MyStruct { field: 42 };
18 const TUP: (usize,) = (43,);
19 const NESTED_S: Nested = Nested { nested: MyStruct { field: 5 } };
20 const NESTED_T: ((usize,),) = ((4,),);
21 const MIX_1: ((Nested,),) = ((Nested { nested: MyStruct { field: 3 } },),);
22 const MIX_2: Mix2 = Mix2 { nested: ((2,),) };
23 const INSTANT_1: usize = (MyStruct { field: 1 }).field;
24 const INSTANT_2: usize = (0,).0;
27 let a = [0; STRUCT.field];
29 let c = [0; NESTED_S.nested.field];
30 let d = [0; (NESTED_T.0).0];
31 let e = [0; (MIX_1.0).0.nested.field];
32 let f = [0; (MIX_2.nested.0).0];
33 let g = [0; INSTANT_1];
34 let h = [0; INSTANT_2];
36 assert_eq!(a.len(), 42);
37 assert_eq!(b.len(), 43);
38 assert_eq!(c.len(), 5);
39 assert_eq!(d.len(), 4);
40 assert_eq!(e.len(), 3);
41 assert_eq!(f.len(), 2);
42 assert_eq!(g.len(), 1);
43 assert_eq!(h.len(), 0);