about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-10-16 18:03:02 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-10-19 15:51:53 +0000
commitf65eb1f7522bc41d86bf3361111c27f8979063c5 (patch)
treea202c7bf0d1597b0640c987b7c18e76144537d03
parent00a7958e7945c4ed4070b999435909da94233942 (diff)
downloadrust-f65eb1f7522bc41d86bf3361111c27f8979063c5.tar.gz
rust-f65eb1f7522bc41d86bf3361111c27f8979063c5.zip
FileCheck basic_assignment.rs.
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir4
-rw-r--r--tests/mir-opt/basic_assignment.rs19
2 files changed, 20 insertions, 3 deletions
diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
index 99b51a4e92f..5df6633880e 100644
--- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
@@ -1,8 +1,8 @@
 // MIR for `main` after SimplifyCfg-initial
 
 | User Type Annotations
-| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
-| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:21:17: 21:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 0: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
+| 1: user_ty: Canonical { value: Ty(std::option::Option<std::boxed::Box<u32>>), max_universe: U0, variables: [] }, span: $DIR/basic_assignment.rs:38:17: 38:33, inferred_ty: std::option::Option<std::boxed::Box<u32>>
 |
 fn main() -> () {
     let mut _0: ();
diff --git a/tests/mir-opt/basic_assignment.rs b/tests/mir-opt/basic_assignment.rs
index 87e01932cb1..30a41098888 100644
--- a/tests/mir-opt/basic_assignment.rs
+++ b/tests/mir-opt/basic_assignment.rs
@@ -1,4 +1,4 @@
-// skip-filecheck
+// unit-test: ElaborateDrops
 // needs-unwind
 // this tests move up progration, which is not yet implemented
 
@@ -11,6 +11,23 @@
 // destruction.
 
 fn main() {
+    // CHECK-LABEL: fn main(
+    // CHECK: debug nodrop_x => [[nodrop_x:_.*]];
+    // CHECK: debug nodrop_y => [[nodrop_y:_.*]];
+    // CHECK: debug drop_x => [[drop_x:_.*]];
+    // CHECK: debug drop_y => [[drop_y:_.*]];
+    // CHECK-NOT: drop([[nodrop_x]])
+    // CHECK-NOT: drop([[nodrop_y]])
+    // CHECK-NOT: drop([[drop_x]])
+    // CHECK: [[drop_tmp:_.*]] = move [[drop_x]];
+    // CHECK-NOT: drop([[drop_x]])
+    // CHECK-NOT: drop([[drop_tmp]])
+    // CHECK: [[drop_y]] = move [[drop_tmp]];
+    // CHECK-NOT: drop([[drop_x]])
+    // CHECK-NOT: drop([[drop_tmp]])
+    // CHECK: drop([[drop_y]])
+    // CHECK-NOT: drop([[drop_x]])
+    // CHECK-NOT: drop([[drop_tmp]])
     let nodrop_x = false;
     let nodrop_y;