Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cd77d59

Browse files
committed
update enum.rs for code review
1 parent 1c886d7 commit cd77d59

File tree

1 file changed

+10
-1
lines changed
  • tests/mir-opt/dataflow-const-prop

1 file changed

+10
-1
lines changed

tests/mir-opt/dataflow-const-prop/enum.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ fn multiple(x: bool, i: u8) {
118118
// CHECK: debug x => [[x:_.*]];
119119
// CHECK: debug e => [[e:_.*]];
120120
// CHECK: debug x2 => [[x2:_.*]];
121+
// CHECK: debug y => [[y:_.*]];
121122
let e = if x {
122123
// CHECK: [[e]] = Option::<u8>::Some(move {{_.*}});
123124
Some(i)
@@ -128,10 +129,18 @@ fn multiple(x: bool, i: u8) {
128129
// The dataflow state must have:
129130
// discriminant(e) => Top
130131
// (e as Some).0 => Top
132+
// CHECK-NOT: [[x2]] = const 5
131133
// CHECK: [[x2]] = const 0_u8;
132-
// CHECK: [[x2]] = {{_.*}};
134+
// CHECK-NOT: [[x2]] = const 5
135+
// CHECK: [[some:_.*]] = (({{_.*}} as Some
136+
// CHECK: [[x2]] = [[some]];
133137
let x2 = match e { Some(i) => i, None => 0 };
138+
134139
// Therefore, `x2` should be `Top` here, and no replacement shall happen.
140+
141+
// CHECK-NOT: [[y]] = const
142+
// CHECK: [[y]] = [[x2]];
143+
// CHECK-NOT: [[y]] = const
135144
let y = x2;
136145
}
137146

0 commit comments

Comments
 (0)