Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error code E0783

The range pattern ... is no longer allowed.

Erroneous code example:

#![allow(unused)]
fn main() {
match 2u8 {
    0...9 => println!("Got a number less than 10"), // error!
    _ => println!("Got a number 10 or more"),
}
}

Older Rust code using previous editions allowed ... to stand for inclusive ranges which are now signified using ..=.

To make this code compile replace the ... with ..=.

#![allow(unused)]
fn main() {
match 2u8 {
    0..=9 => println!("Got a number less than 10"), // ok!
    _ => println!("Got a number 10 or more"),
}
}