The Operators and Symbols appendix of the Rust Book lists two operators which are both right-inclusive ranges:
| Operator | Example | Explanation |
|---|---|---|
..= |
..=expr, expr..=expr |
Right-inclusive range literal |
... |
expr...expr |
In a pattern: inclusive range pattern |
What is the difference between these two operators? Or, phrased differently, what is the difference between a range literal and a range pattern?
'In a pattern' suggests that expr...expr must be used in a match expression and expr..=expr should not be. Why is this?