2021-04-03 11:05:11 +00:00
|
|
|
//
|
2018-05-08 13:10:16 +00:00
|
|
|
//@ compile-flags:-Zprint-mono-items=eager
|
2017-10-06 21:59:33 +00:00
|
|
|
//@ compile-flags:-Zinline-in-all-cgus
|
2024-06-29 07:48:23 +00:00
|
|
|
//@ compile-flags:-Zinline-mir=no
|
2016-05-10 21:24:44 +00:00
|
|
|
|
2017-12-22 14:31:51 +00:00
|
|
|
#![feature(start)]
|
|
|
|
|
2021-02-14 21:42:38 +00:00
|
|
|
//~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDtor> - shim(Some(StructWithDtor)) @@ drop_in_place_intrinsic-cgu.0[Internal]
|
2016-05-10 21:24:44 +00:00
|
|
|
struct StructWithDtor(u32);
|
|
|
|
|
|
|
|
impl Drop for StructWithDtor {
|
2020-08-28 13:31:03 +00:00
|
|
|
//~ MONO_ITEM fn <StructWithDtor as std::ops::Drop>::drop
|
2016-05-10 21:24:44 +00:00
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
2020-08-28 13:31:03 +00:00
|
|
|
//~ MONO_ITEM fn start
|
2017-12-22 14:31:51 +00:00
|
|
|
#[start]
|
|
|
|
fn start(_: isize, _: *const *const u8) -> isize {
|
2021-02-14 21:42:38 +00:00
|
|
|
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal]
|
2016-05-10 21:24:44 +00:00
|
|
|
let x = [StructWithDtor(0), StructWithDtor(1)];
|
|
|
|
|
|
|
|
drop_slice_in_place(&x);
|
2017-12-22 14:31:51 +00:00
|
|
|
|
|
|
|
0
|
2016-05-10 21:24:44 +00:00
|
|
|
}
|
|
|
|
|
2020-08-28 13:31:03 +00:00
|
|
|
//~ MONO_ITEM fn drop_slice_in_place
|
2016-05-10 21:24:44 +00:00
|
|
|
fn drop_slice_in_place(x: &[StructWithDtor]) {
|
|
|
|
unsafe {
|
|
|
|
// This is the interesting thing in this test case: Normally we would
|
|
|
|
// not have drop-glue for the unsized [StructWithDtor]. This has to be
|
|
|
|
// generated though when the drop_in_place() intrinsic is used.
|
2021-02-14 21:42:38 +00:00
|
|
|
//~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor]> - shim(Some([StructWithDtor])) @@ drop_in_place_intrinsic-cgu.0[Internal]
|
|
|
|
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
|
2016-05-10 21:24:44 +00:00
|
|
|
}
|
|
|
|
}
|