about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsfzhu93 <zhushuofei@gmail.com>2024-01-12 20:50:28 -0800
committersfzhu93 <zhushuofei@gmail.com>2024-01-12 20:50:28 -0800
commitcd77d59f97cba2909b457b2ebb36f201b9dcb532 (patch)
tree6f582d50248a82c72a44b879aa26c227efb66885
parent1c886d794c1772eb6a51e84939ef1093e9e10e17 (diff)
downloadrust-cd77d59f97cba2909b457b2ebb36f201b9dcb532.tar.gz
rust-cd77d59f97cba2909b457b2ebb36f201b9dcb532.zip
update enum.rs for code review
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 26fdda2664a..8a6fe3a3fda 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -118,6 +118,7 @@ fn multiple(x: bool, i: u8) {
     // CHECK: debug x => [[x:_.*]];
     // CHECK: debug e => [[e:_.*]];
     // CHECK: debug x2 => [[x2:_.*]];
+    // CHECK: debug y => [[y:_.*]];
     let e = if x {
         // CHECK: [[e]] = Option::<u8>::Some(move {{_.*}});
         Some(i)
@@ -128,10 +129,18 @@ fn multiple(x: bool, i: u8) {
     // The dataflow state must have:
     //   discriminant(e) => Top
     //   (e as Some).0 => Top
+    // CHECK-NOT: [[x2]] = const 5
     // CHECK: [[x2]] = const 0_u8;
-    // CHECK: [[x2]] = {{_.*}};
+    // CHECK-NOT: [[x2]] = const 5
+    // CHECK: [[some:_.*]] = (({{_.*}} as Some
+    // CHECK: [[x2]] = [[some]];
     let x2 = match e { Some(i) => i, None => 0 };
+
     // Therefore, `x2` should be `Top` here, and no replacement shall happen.
+
+    // CHECK-NOT: [[y]] = const
+    // CHECK: [[y]] = [[x2]];
+    // CHECK-NOT: [[y]] = const
     let y = x2;
 }