]>
Commit | Line | Data |
---|---|---|
f9f354fc | 1 | A lower range wasn't less than the upper range. |
60c5eb7d XL |
2 | |
3 | Erroneous code example: | |
4 | ||
5 | ```compile_fail,E0579 | |
6 | #![feature(exclusive_range_pattern)] | |
7 | ||
8 | fn main() { | |
9 | match 5u32 { | |
10 | // This range is ok, albeit pointless. | |
2b03887a | 11 | 1..2 => {} |
60c5eb7d | 12 | // This range is empty, and the compiler can tell. |
2b03887a | 13 | 5..5 => {} // error! |
60c5eb7d XL |
14 | } |
15 | } | |
16 | ``` | |
f9f354fc XL |
17 | |
18 | When matching against an exclusive range, the compiler verifies that the range | |
19 | is non-empty. Exclusive range patterns include the start point but not the end | |
20 | point, so this is equivalent to requiring the start of the range to be less | |
21 | than the end of the range. |