Skip to content

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

Closed
@ftxqxd

Description

@ftxqxd

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.

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