rust/tests/ui/parser/range_inclusive_dotdotdot.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
880 B
Rust
Raw Normal View History

2017-11-06 06:04:54 -06:00
// Make sure that inclusive ranges with `...` syntax don't parse.
use std::ops::RangeToInclusive;
fn return_range_to() -> RangeToInclusive<i32> {
return ...1; //~ERROR unexpected token: `...`
//~^HELP use `..` for an exclusive range
//~^^HELP or `..=` for an inclusive range
2017-11-06 06:04:54 -06:00
}
pub fn main() {
let x = ...0; //~ERROR unexpected token: `...`
//~^HELP use `..` for an exclusive range
//~^^HELP or `..=` for an inclusive range
2017-11-06 06:04:54 -06:00
let x = 5...5; //~ERROR unexpected token: `...`
//~^HELP use `..` for an exclusive range
//~^^HELP or `..=` for an inclusive range
2017-11-06 06:04:54 -06:00
for _ in 0...1 {} //~ERROR unexpected token: `...`
//~^HELP use `..` for an exclusive range
//~^^HELP or `..=` for an inclusive range
2017-11-06 06:04:54 -06:00
}