]> git.lizzy.rs Git - rust.git/blob - src/test/ui/range/range-inclusive-pattern-precedence2.rs
Rollup merge of #102092 - kxxt:patch-1, r=joshtriplett
[rust.git] / src / test / ui / range / range-inclusive-pattern-precedence2.rs
1 // We are going to disallow `&a..=b` and `box a..=b` in a pattern. However, the
2 // older ... syntax is still allowed as a stability guarantee.
3
4 #![feature(box_patterns)]
5 #![warn(ellipsis_inclusive_range_patterns)]
6
7 fn main() {
8     match Box::new(12) {
9         // FIXME: can we add suggestions like `&(0..=9)`?
10         box 0...9 => {}
11         //~^ WARN `...` range patterns are deprecated
12         //~| WARN this is accepted in the current edition
13         //~| HELP use `..=` for an inclusive range
14         box 10..=15 => {}
15         //~^ ERROR the range pattern here has ambiguous interpretation
16         //~^^ HELP add parentheses to clarify the precedence
17         box (16..=20) => {}
18         _ => {}
19     }
20 }