summary refs log tree commit diff
path: root/tests/codegen-units/item-collection/drop-glue-noop.rs
blob: 604ba883bb289556c79826cc70867fe5aa40b1bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@ compile-flags:-Clink-dead-code -Zmir-opt-level=0

#![deny(dead_code)]
#![crate_type = "lib"]

//~ MONO_ITEM fn start
#[no_mangle]
pub fn start(_: isize, _: *const *const u8) -> isize {
    // No item produced for this, it's a no-op drop and so is removed.
    unsafe {
        std::ptr::drop_in_place::<u32>(&mut 0);
    }

    // No choice but to codegen for indirect drop as a function pointer, since we have to produce a
    // function with the right signature. In vtables we can avoid that (tested in
    // instantiation-through-vtable.rs) because we special case null pointer for drop glue since
    // #122662.
    //
    //~ MONO_ITEM fn std::ptr::drop_in_place::<u64> - shim(None) @@ drop_glue_noop-cgu.0[External]
    std::ptr::drop_in_place::<u64> as unsafe fn(*mut u64);

    0
}