]>
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-trans-items=eager
13 // compile-flags:-Zinline-in-all-cgus
15 //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic0[Internal]
16 struct StructWithDtor(u32);
18 impl Drop
for StructWithDtor
{
19 //~ TRANS_ITEM fn drop_in_place_intrinsic::{{impl}}[0]::drop[0]
23 //~ TRANS_ITEM fn drop_in_place_intrinsic::main[0]
26 //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal]
27 let x
= [StructWithDtor(0), StructWithDtor(1)];
29 drop_slice_in_place(&x
);
32 //~ TRANS_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0]
33 fn drop_slice_in_place(x
: &[StructWithDtor
]) {
35 // This is the interesting thing in this test case: Normally we would
36 // not have drop-glue for the unsized [StructWithDtor]. This has to be
37 // generated though when the drop_in_place() intrinsic is used.
38 //~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic0[Internal]
39 ::std
::ptr
::drop_in_place(x
as *const _
as *mut [StructWithDtor
]);