Skip to content

Pattern matches with ranges & unsucessful guards don't behave correctly #13027

Closed

Description

The following code prints 3 instead of 2:

println!("{}", match 1 {
    1 if false => 1,
    1..2 => 2,
    _ => 3
});

Removing the first arm (1 if false => ...) makes it print 2 as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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