Skip to content

Commit e5d4075

Browse files
committed
FileCheck box_expr.rs
This check is made `needs-unwind`, as the panic=abort case is a strictly simpler version.
1 parent d1c67a0 commit e5d4075

File tree

3 files changed

+14
-73
lines changed

3 files changed

+14
-73
lines changed

tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir

-71
This file was deleted.

tests/mir-opt/box_expr.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
// skip-filecheck
2-
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
1+
// unit-test: ElaborateDrops
2+
// needs-unwind
33

44
#![feature(rustc_attrs, stmt_expr_attributes)]
55

66
// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
77
fn main() {
8+
// CHECK-LABEL: fn main(
9+
// CHECK: [[box:_.*]] = ShallowInitBox(
10+
// CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
11+
// CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
12+
// CHECK: [[ret]]: {
13+
// CHECK: [[box2:_.*]] = move [[box]];
14+
// CHECK: [[box3:_.*]] = move [[box2]];
15+
// CHECK: std::mem::drop::<Box<S>>(move [[box3]])
16+
// CHECK: [[unwind]] (cleanup): {
17+
// CHECK: [[boxref:_.*]] = &mut [[box]];
18+
// CHECK: <Box<S> as Drop>::drop(move [[boxref]])
19+
820
let x = #[rustc_box]
921
Box::new(S::new());
1022
drop(x);

0 commit comments

Comments
 (0)