]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-9382.rs
Auto merge of #96711 - emilio:inline-slice-clone, r=nikic
[rust.git] / src / test / ui / issues / issue-9382.rs
1 // pretty-expanded FIXME #23616
2
3
4 // run-pass
5 #![allow(dead_code)]
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> {
14     baz: &'a [Box<isize>],
15     bar: Box<u64>,
16 }
17
18 struct Thing2<'a> {
19     baz: &'a [Box<isize>],
20     bar: u64,
21 }
22
23 pub fn main() {
24     let _t1_fixed = Thing1 {
25         baz: &[],
26         bar: Box::new(32),
27     };
28     Thing1 {
29         baz: &Vec::new(),
30         bar: Box::new(32),
31     };
32     let _t2_fixed = Thing2 {
33         baz: &[],
34         bar: 32,
35     };
36     Thing2 {
37         baz: &Vec::new(),
38         bar: 32,
39     };
40 }