Rust-GCC / gccrs

GCC Front-End for Rust

Home Page:https://rust-gcc.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Match pattern not parsed correctly

P-E-P opened this issue · comments

I tried this code:

#![feature(exclusive_range_pattern)]

const UPPER: usize = 10;

fn test(n: usize) {
    match n {
        0..UPPER => (),
        UPPER..20 => (),
        20..30 => (),
        _ => (),
    }
}

https://godbolt.org/z/MnrT88Mqc

I expected to see this happen: No error

Instead, this happened: Parser is expecting an arrow => and complains it found a .. instead.


<source>:7:10: error: expecting '=>' but '..' found
    7 |         0..UPPER => (),
      |          ^~
<source>:6:5: error: failed to parse statement or expression in block expression
    6 |     match n {
      |     ^~~~~
<source>:7:10: error: unrecognised token '..' for start of item
    7 |         0..UPPER => (),
      |          ^~
<source>:7:10: error: failed to parse item in crate
Compiler returned: 1

Meta