about summary refs log tree commit diff
path: root/tests/mir-opt/remove_unneeded_drop_in_place.rs
blob: 470c6499d169cdfc13bcaaa5857e8b4744a0b29c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//@ test-mir-pass: RemoveUnneededDrops
//@ needs-unwind
//@ compile-flags: -Z mir-opt-level=1

// EMIT_MIR remove_unneeded_drop_in_place.slice_in_place.RemoveUnneededDrops.diff
unsafe fn slice_in_place(ptr: *mut [char]) {
    // CHECK-LABEL: fn slice_in_place(_1: *mut [char])
    // CHECK: bb0: {
    // CHECK-NEXT: return;
    // CHECK-NEXT: }
    std::ptr::drop_in_place(ptr)
}

fn main() {
    let mut a = ['o', 'k'];
    unsafe { slice_in_place(&raw mut a) };
}