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