Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/test/codegen/match-optimizes-away.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
// compile-flags: -O
#![crate_type="lib"]

pub enum Three { First, Second, Third }
use Three::*;
pub enum Three { A, B, C }

pub enum Four { First, Second, Third, Fourth }
use Four::*;
pub enum Four { A, B, C, D }

#[no_mangle]
pub fn three_valued(x: Three) -> Three {
// CHECK-LABEL: @three_valued
// CHECK-NEXT: {{^.*:$}}
// CHECK-NEXT: ret i8 %0
match x {
First => First,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man, this is plain evil.
I'll make an issue for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second => Second,
Third => Third,
Three::A => Three::A,
Three::B => Three::B,
Three::C => Three::C,
}
}

Expand All @@ -36,9 +34,9 @@ pub fn four_valued(x: Four) -> Four {
// CHECK-NEXT: {{^.*:$}}
// CHECK-NEXT: ret i8 %0
match x {
First => First,
Second => Second,
Third => Third,
Fourth => Fourth,
Four::A => Four::A,
Four::B => Four::B,
Four::C => Four::C,
Four::D => Four::D,
}
}