Skip to content

Commit

Permalink
FileCheck box_expr.rs
Browse files Browse the repository at this point in the history
This check is made `needs-unwind`, as the panic=abort case is a strictly
simpler version.
  • Loading branch information
cjgillot committed Oct 16, 2023
1 parent d1c67a0 commit e5d4075
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 73 deletions.
71 changes: 0 additions & 71 deletions tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir

This file was deleted.

16 changes: 14 additions & 2 deletions tests/mir-opt/box_expr.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ElaborateDrops
// needs-unwind

#![feature(rustc_attrs, stmt_expr_attributes)]

// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
fn main() {
// CHECK-LABEL: fn main(
// CHECK: [[box:_.*]] = ShallowInitBox(
// CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S);
// CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]];
// CHECK: [[ret]]: {
// CHECK: [[box2:_.*]] = move [[box]];
// CHECK: [[box3:_.*]] = move [[box2]];
// CHECK: std::mem::drop::<Box<S>>(move [[box3]])
// CHECK: [[unwind]] (cleanup): {
// CHECK: [[boxref:_.*]] = &mut [[box]];
// CHECK: <Box<S> as Drop>::drop(move [[boxref]])

let x = #[rustc_box]
Box::new(S::new());
drop(x);
Expand Down

0 comments on commit e5d4075

Please sign in to comment.