Skip to content

Interval match patterns won't parse namespace specifiers correctly #21475

Closed
@simias

Description

@simias

The following code:

use m::{START, STOP};

fn main() {
    let i = 12u32;

    match i {
        20...30           => println!("ok"),
        START...END       => println!("still ok"),
        m::START...m::END => println!("bad"),
        _                 => (),
    }
}

mod m {
  const START: u32 = 4;
  const END:   u32 = 14;
}

Produces this error:

<anon>:10:17: 10:20 error: expected one of `::`, `=>`, or `|`, found `...`
<anon>:10         m::START...m::END => println!("bad"),
                          ^~~

Putting parens around m::START and m::END doesn't fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an ASTE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions