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

Incorrect result when using match on tuple with slice #16648

Closed
retep998 opened this issue Aug 21, 2014 · 3 comments · Fixed by #16883
Closed

Incorrect result when using match on tuple with slice #16648

retep998 opened this issue Aug 21, 2014 · 3 comments · Fixed by #16883
Labels
P-medium Medium priority

Comments

@retep998
Copy link
Member

This causes bad to be output

fn main() {
    let x = (2i, &[1i, 2i]);
    match x {
        (0, [_, _]) => {},
        (1, _) => {},
        (2, [_, _]) => println!("good"),
        (2, _) => println!("bad"),
        _ => {},
    }
}

Deleting either (0, [_, _]) => {}, or (1, _) => {}, causes it to output good.

@alexcrichton
Copy link
Member

cc @jakub-, nominating

@ghost
Copy link

ghost commented Aug 22, 2014

Yeah, this is insane. I'll take a stab at rewriting the decision tree compilation this weekend.

@pnkfelix
Copy link
Member

While this is indeed insane, it is "just a bug", and not going to block the 1.0 release. (It is/was borderline for P-backcompat-lang though...)

P-high, not 1.0 milestone.

bors added a commit that referenced this issue Sep 4, 2014
They were only correct in the simplest case. Some of the optimisations
are certainly possible but should be introduced carefully and only
when the whole pattern codegen infrastructure is in a better shape.

Fixes #16648.
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 25, 2024
internal: Pin commit of rust-lang/rust for rustc-test metrics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-medium Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants