Operators in patterns have incorrect priorities (original) (raw)

(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.