]>
Commit | Line | Data |
---|---|---|
17df50a5 XL |
1 | The range pattern `...` is no longer allowed. |
2 | ||
3 | Erroneous code example: | |
4 | ||
5 | ```edition2021,compile_fail,E0783 | |
6 | match 2u8 { | |
7 | 0...9 => println!("Got a number less than 10"), // error! | |
8 | _ => println!("Got a number 10 or more"), | |
9 | } | |
10 | ``` | |
11 | ||
12 | Older Rust code using previous editions allowed `...` to stand for exclusive | |
13 | ranges which are now signified using `..=`. | |
14 | ||
15 | To make this code compile replace the `...` with `..=`. | |
16 | ||
17 | ```edition2021 | |
18 | match 2u8 { | |
19 | 0..=9 => println!("Got a number less than 10"), // ok! | |
20 | _ => println!("Got a number 10 or more"), | |
21 | } | |
22 | ``` |