We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb8b11e commit 470823eCopy full SHA for 470823e
tests/codegen/enum/enum-early-otherwise-branch.rs
@@ -0,0 +1,25 @@
1
+// compile-flags: -O -Zmir-opt-level=3 -Zunsound-mir-opts
2
+
3
+#![crate_type = "lib"]
4
5
+pub enum Enum {
6
+ A(u32),
7
+ B(u32),
8
+ C(u32),
9
+}
10
11
+#[no_mangle]
12
+pub fn foo(lhs: &Enum, rhs: &Enum) -> bool {
13
+ // CHECK-LABEL: define{{.*}}i1 @foo(
14
+ // CHECK-NOT: switch
15
+ // CHECK-NOT: br
16
+ // CHECK: [[SELECT:%.*]] = select
17
+ // CHECK-NEXT: ret i1 [[SELECT]]
18
+ // CHECK-NEXT: }
19
+ match (lhs, rhs) {
20
+ (Enum::A(lhs), Enum::A(rhs)) => lhs == rhs,
21
+ (Enum::B(lhs), Enum::B(rhs)) => lhs == rhs,
22
+ (Enum::C(lhs), Enum::C(rhs)) => lhs == rhs,
23
+ _ => false,
24
+ }
25
0 commit comments