summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/box_expr.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
commitcec1877e180393eba0f6ddb0cf97bf3a791631c7 (patch)
tree47b4dac2a9dd9a40c30c251b4d4a72d7ccf77e9f /tests/mir-opt/box_expr.rs
parentAdding debian version 1.74.1+dfsg1-1. (diff)
downloadrustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.tar.xz
rustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/box_expr.rs')
-rw-r--r--tests/mir-opt/box_expr.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs
index 780420bda..0421e232a 100644
--- a/tests/mir-opt/box_expr.rs
+++ b/tests/mir-opt/box_expr.rs
@@ -1,9 +1,22 @@
-// 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
+// EMIT_MIR box_expr.main.ElaborateDrops.diff
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);