]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs
1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-tidy-linelength
12 // compile-flags:-Zprint-mono-items=eager
13 // compile-flags:-Zinline-in-all-cgus
17 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
18 struct StructWithDtor(u32);
20 impl Drop
for StructWithDtor
{
21 //~ MONO_ITEM fn drop_in_place_intrinsic::{{impl}}[0]::drop[0]
25 //~ MONO_ITEM fn drop_in_place_intrinsic::start[0]
27 fn start(_
: isize, _
: *const *const u8) -> isize {
29 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
30 let x
= [StructWithDtor(0), StructWithDtor(1)];
32 drop_slice_in_place(&x
);
37 //~ MONO_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0]
38 fn drop_slice_in_place(x
: &[StructWithDtor
]) {
40 // This is the interesting thing in this test case: Normally we would
41 // not have drop-glue for the unsized [StructWithDtor]. This has to be
42 // generated though when the drop_in_place() intrinsic is used.
43 //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
44 ::std
::ptr
::drop_in_place(x
as *const _
as *mut [StructWithDtor
]);