Skip to content

match miscompiled with range and wildcard #31373

Closed
@durka

Description

@durka

This may be the same bug as #18060. This code

fn main() {
    // ok
    match (1, 0) {
        (0, 0...1) |
        (1, 0...0) => Ok(()),
        _ => Err(())
    }.unwrap();

    // error
    match (1, 0) {
        (0, 0...1) |           // <-- endpoint of first range must be greater than that of the second one
        (1, 0...0) => Ok(()),
        (_, _) => Err(())      // <-- must be a tuple of _
    }.unwrap();
}

gets the second match wrong somehow, under very specific circumstances. Minified from user "bellows" in #rust-beginners.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions