rust/tests/mir-opt/building/uniform_array_move_out.rs
Ralf Jung 5e65109f21 add write_box_via_move intrinsic and use it for vec!
This allows us to get rid of box_new entirely
2026-02-16 17:27:40 +01:00

21 lines
597 B
Rust

//@ compile-flags: -Zmir-opt-level=0
// skip-filecheck
// Can't emit `built.after` here as that contains user type annotations which contain DefId that
// change all the time.
// EMIT_MIR uniform_array_move_out.move_out_from_end.CleanupPostBorrowck.after.mir
fn move_out_from_end() {
let a = [Box::new(1), Box::new(2)];
let [.., _y] = a;
}
// EMIT_MIR uniform_array_move_out.move_out_by_subslice.CleanupPostBorrowck.after.mir
fn move_out_by_subslice() {
let a = [Box::new(1), Box::new(2)];
let [_y @ ..] = a;
}
fn main() {
move_out_by_subslice();
move_out_from_end();
}