2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2013-12-05 22:13:46 -05:00
|
|
|
|
2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2013-12-05 22:13:46 -05:00
|
|
|
|
2014-08-01 19:42:13 -04:00
|
|
|
// Tests for a previous bug that occurred due to an interaction
|
2013-12-05 22:13:46 -05:00
|
|
|
// between struct field initialization and the auto-coercion
|
|
|
|
// from a vector to a slice. The drop glue was being invoked on
|
|
|
|
// the temporary slice with a wrong type, triggering an LLVM assert.
|
|
|
|
|
2014-03-05 15:28:08 -08:00
|
|
|
|
2013-12-09 23:16:18 -08:00
|
|
|
struct Thing1<'a> {
|
2015-03-25 17:06:52 -07:00
|
|
|
baz: &'a [Box<isize>],
|
2014-05-05 18:56:44 -07:00
|
|
|
bar: Box<u64>,
|
2013-12-05 22:13:46 -05:00
|
|
|
}
|
|
|
|
|
2013-12-09 23:16:18 -08:00
|
|
|
struct Thing2<'a> {
|
2015-03-25 17:06:52 -07:00
|
|
|
baz: &'a [Box<isize>],
|
2013-12-05 22:13:46 -05:00
|
|
|
bar: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
let _t1_fixed = Thing1 {
|
2014-01-15 14:39:08 -05:00
|
|
|
baz: &[],
|
2022-07-07 04:36:10 +02:00
|
|
|
bar: Box::new(32),
|
2013-12-05 22:13:46 -05:00
|
|
|
};
|
2014-01-15 14:39:08 -05:00
|
|
|
Thing1 {
|
2015-02-01 21:53:25 -05:00
|
|
|
baz: &Vec::new(),
|
2022-07-07 04:36:10 +02:00
|
|
|
bar: Box::new(32),
|
2013-12-05 22:13:46 -05:00
|
|
|
};
|
|
|
|
let _t2_fixed = Thing2 {
|
2014-01-15 14:39:08 -05:00
|
|
|
baz: &[],
|
2013-12-05 22:13:46 -05:00
|
|
|
bar: 32,
|
|
|
|
};
|
2014-01-15 14:39:08 -05:00
|
|
|
Thing2 {
|
2015-02-01 21:53:25 -05:00
|
|
|
baz: &Vec::new(),
|
2013-12-05 22:13:46 -05:00
|
|
|
bar: 32,
|
|
|
|
};
|
|
|
|
}
|