Skip to content

What should be allowed in the pattern grammar? #5184

Closed
@ghost

Description

Consider the following code:

let a = 0b11;
let b = match a {
  0b01 | 0b10 => true,
  _ => false
};
io::println(b.to_str());

The output is false, but let b = (a == 0b01 | 0b10); yields true.

I don't know how common patterns containing bitwise ors would be, but it seems inconsistent for this operator to be unavailable when the other arithmetic and bitwise ops function as expected here:

let a = 0b11;
let b = match a {
  0b01 + 0b10 => true,
  _ => false
};
io::println(b.to_str());

The output is true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions