diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0579.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0579.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0579.md b/compiler/rustc_error_codes/src/error_codes/E0579.md new file mode 100644 index 000000000..f554242a3 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0579.md @@ -0,0 +1,21 @@ +A lower range wasn't less than the upper range. + +Erroneous code example: + +```compile_fail,E0579 +#![feature(exclusive_range_pattern)] + +fn main() { + match 5u32 { + // This range is ok, albeit pointless. + 1 .. 2 => {} + // This range is empty, and the compiler can tell. + 5 .. 5 => {} // error! + } +} +``` + +When matching against an exclusive range, the compiler verifies that the range +is non-empty. Exclusive range patterns include the start point but not the end +point, so this is equivalent to requiring the start of the range to be less +than the end of the range. |