]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-9382.rs
Rollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin
[rust.git] / src / test / ui / issues / issue-9382.rs
1 // pretty-expanded FIXME #23616
2
3
4 // run-pass
5 #![allow(dead_code)]
6 #![feature(box_syntax)]
7
8 // Tests for a previous bug that occurred due to an interaction
9 // between struct field initialization and the auto-coercion
10 // from a vector to a slice. The drop glue was being invoked on
11 // the temporary slice with a wrong type, triggering an LLVM assert.
12
13
14 struct Thing1<'a> {
15     baz: &'a [Box<isize>],
16     bar: Box<u64>,
17 }
18
19 struct Thing2<'a> {
20     baz: &'a [Box<isize>],
21     bar: u64,
22 }
23
24 pub fn main() {
25     let _t1_fixed = Thing1 {
26         baz: &[],
27         bar: box 32,
28     };
29     Thing1 {
30         baz: &Vec::new(),
31         bar: box 32,
32     };
33     let _t2_fixed = Thing2 {
34         baz: &[],
35         bar: 32,
36     };
37     Thing2 {
38         baz: &Vec::new(),
39         bar: 32,
40     };
41 }