mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 13:46:03 +00:00
18 lines
467 B
Rust
18 lines
467 B
Rust
//@ 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) };
|
|
}
|