Clean up E0029

This commit is contained in:
Guillaume Gomez 2019-11-15 13:14:10 +01:00
parent 86506281b5
commit f8d575a007

View File

@ -1,8 +1,6 @@
In a match expression, only numbers and characters can be matched against a
range. This is because the compiler checks that the range is non-empty at
compile-time, and is unable to evaluate arbitrary comparison functions. If you
want to capture values of an orderable type between two end-points, you can use
a guard.
Something other than numbers and characters has been used for a range.
Erroneous code example:
```compile_fail,E0029
let string = "salutations !";
@ -20,3 +18,9 @@ match string {
_ => {}
}
```
In a match expression, only numbers and characters can be matched against a
range. This is because the compiler checks that the range is non-empty at
compile-time, and is unable to evaluate arbitrary comparison functions. If you
want to capture values of an orderable type between two end-points, you can use
a guard.