]> git.lizzy.rs Git - rust.git/blob - src/test/ui/range/range-inclusive-pattern-precedence.rs
Auto merge of #99028 - tmiasko:inline, r=estebank
[rust.git] / src / test / ui / range / range-inclusive-pattern-precedence.rs
1 // In expression, `&a..=b` is treated as `(&a)..=(b)` and `box a..=b` is
2 // `(box a)..=(b)`. In a pattern, however, `&a..=b` means `&(a..=b)`. This may
3 // lead to confusion.
4
5 // run-rustfix
6
7 #![warn(ellipsis_inclusive_range_patterns)]
8
9 pub fn main() {
10     match &12 {
11         &0...9 => {}
12         //~^ WARN `...` range patterns are deprecated
13         //~| WARN this is accepted in the current edition
14         //~| HELP use `..=` for an inclusive range
15         &10..=15 => {}
16         //~^ ERROR the range pattern here has ambiguous interpretation
17         //~| HELP add parentheses to clarify the precedence
18         &(16..=20) => {}
19         _ => {}
20     }
21 }