]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_error_codes/src/error_codes/E0579.md
New upstream version 1.66.0+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0579.md
CommitLineData
f9f354fc 1A lower range wasn't less than the upper range.
60c5eb7d
XL
2
3Erroneous code example:
4
5```compile_fail,E0579
6#![feature(exclusive_range_pattern)]
7
8fn 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
18When matching against an exclusive range, the compiler verifies that the range
19is non-empty. Exclusive range patterns include the start point but not the end
20point, so this is equivalent to requiring the start of the range to be less
21than the end of the range.