]>
Commit | Line | Data |
---|---|---|
c34b1796 AL |
1 | // pretty-expanded FIXME #23616 |
2 | ||
1a4d82fc | 3 | |
b7449926 | 4 | // run-pass |
0bf4aa26 | 5 | #![allow(dead_code)] |
1a4d82fc JJ |
6 | |
7 | // Tests for a previous bug that occurred due to an interaction | |
8 | // between struct field initialization and the auto-coercion | |
9 | // from a vector to a slice. The drop glue was being invoked on | |
10 | // the temporary slice with a wrong type, triggering an LLVM assert. | |
11 | ||
12 | ||
13 | struct Thing1<'a> { | |
c34b1796 | 14 | baz: &'a [Box<isize>], |
1a4d82fc JJ |
15 | bar: Box<u64>, |
16 | } | |
17 | ||
18 | struct Thing2<'a> { | |
c34b1796 | 19 | baz: &'a [Box<isize>], |
1a4d82fc JJ |
20 | bar: u64, |
21 | } | |
22 | ||
23 | pub fn main() { | |
24 | let _t1_fixed = Thing1 { | |
25 | baz: &[], | |
f2b60f7d | 26 | bar: Box::new(32), |
1a4d82fc JJ |
27 | }; |
28 | Thing1 { | |
85aaf69f | 29 | baz: &Vec::new(), |
f2b60f7d | 30 | bar: Box::new(32), |
1a4d82fc JJ |
31 | }; |
32 | let _t2_fixed = Thing2 { | |
33 | baz: &[], | |
34 | bar: 32, | |
35 | }; | |
36 | Thing2 { | |
85aaf69f | 37 | baz: &Vec::new(), |
1a4d82fc JJ |
38 | bar: 32, |
39 | }; | |
40 | } |