Skip to content

Don't glob-import overlapping variant names in test/codegen/match-optimizes-away.rs. #46078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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,
}
}