]> git.proxmox.com Git - rustc.git/blob - src/test/ui/parser/range_inclusive_dotdotdot.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / parser / range_inclusive_dotdotdot.rs
1 // Make sure that inclusive ranges with `...` syntax don't parse.
2
3 use std::ops::RangeToInclusive;
4
5 fn return_range_to() -> RangeToInclusive<i32> {
6 return ...1; //~ERROR unexpected token: `...`
7 //~^HELP use `..` for an exclusive range
8 //~^^HELP or `..=` for an inclusive range
9 }
10
11 pub fn main() {
12 let x = ...0; //~ERROR unexpected token: `...`
13 //~^HELP use `..` for an exclusive range
14 //~^^HELP or `..=` for an inclusive range
15
16 let x = 5...5; //~ERROR unexpected token: `...`
17 //~^HELP use `..` for an exclusive range
18 //~^^HELP or `..=` for an inclusive range
19
20 for _ in 0...1 {} //~ERROR unexpected token: `...`
21 //~^HELP use `..` for an exclusive range
22 //~^^HELP or `..=` for an inclusive range
23 }