Operators in patterns have incorrect priorities · Issue #48501 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@petrochenkov

Description

@petrochenkov

(Or at least unnatural priorities.)

Binary range operators have higher priority than unary operators like & or box.

#![feature(exclusive_range_pattern)]

fn main() { // Interpreted as (&0) .. (10), ERROR mismatched types let x = &0 .. 10;

match &0 {
    &0 .. 10 => {} // OK?!
    _ => {}
}

}

We can change the priorities for all the unstable kinds of ranges and come up with some deprecation story for stable BEGIN ... END.