Skip to content

Incorrect result when using match on tuple with slice #16648

Closed
@retep998

Description

@retep998

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions