2023-02-27 07:07:44 -06:00
|
|
|
#![feature(stmt_expr_attributes, rustc_attrs)]
|
2018-01-31 14:34:13 -06:00
|
|
|
|
2022-09-04 22:00:31 -05:00
|
|
|
// EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir
|
2018-01-31 14:34:13 -06:00
|
|
|
fn move_out_from_end() {
|
2023-02-27 07:07:44 -06:00
|
|
|
let a = [
|
|
|
|
#[rustc_box]
|
|
|
|
Box::new(1),
|
|
|
|
#[rustc_box]
|
|
|
|
Box::new(2),
|
|
|
|
];
|
2018-01-31 14:34:13 -06:00
|
|
|
let [.., _y] = a;
|
|
|
|
}
|
|
|
|
|
2022-09-04 22:00:31 -05:00
|
|
|
// EMIT_MIR uniform_array_move_out.move_out_by_subslice.built.after.mir
|
2018-01-31 14:34:13 -06:00
|
|
|
fn move_out_by_subslice() {
|
2023-02-27 07:07:44 -06:00
|
|
|
let a = [
|
|
|
|
#[rustc_box]
|
|
|
|
Box::new(1),
|
|
|
|
#[rustc_box]
|
|
|
|
Box::new(2),
|
|
|
|
];
|
2019-07-07 18:47:46 -05:00
|
|
|
let [_y @ ..] = a;
|
2018-01-31 14:34:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
move_out_by_subslice();
|
|
|
|
move_out_from_end();
|
|
|
|
}
|