Skip to content
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

Can omit fields in pattern match #32004

Closed
Aatch opened this issue Mar 2, 2016 · 1 comment
Closed

Can omit fields in pattern match #32004

Aatch opened this issue Mar 2, 2016 · 1 comment
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Aatch
Copy link
Contributor

Aatch commented Mar 2, 2016

This code compiles on nightly:

enum Foo {
    Bar(i32),
    Baz
}

fn main() {
    let x = Foo::Bar(1);

    if let Foo::Bar = x {
        println!("Hello");
    }
}

Which it shouldn't, since Foo::Bar variant has a field and the pattern doesn't mention it. This can also cause an ICE:

enum Foo {
    Bar(i32),
    Baz
}

fn main() {
    match Foo::Bar(42) {
        Foo::Bar(x) => {},
        Foo::Bar => {},
        _ => {}
    }
}
@Aatch Aatch added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Mar 2, 2016
@sanxiyn
Copy link
Member

sanxiyn commented Mar 2, 2016

nightly-2016-02-17 is good, nightly-2016-02-21 is bad.

@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 3, 2016
@arielb1 arielb1 self-assigned this Mar 3, 2016
arielb1 added a commit to arielb1/rust that referenced this issue Mar 4, 2016
bors added a commit that referenced this issue Mar 4, 2016
alexcrichton pushed a commit to alexcrichton/rust that referenced this issue Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants