]> git.proxmox.com Git - rustc.git/blob - tests/ui/inference/range-type-infer.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / inference / range-type-infer.rs
1 // run-pass
2
3 #![allow(unused_must_use)]
4 // Make sure the type inference for the new range expression work as
5 // good as the old one. Check out issue #21672, #21595 and #21649 for
6 // more details.
7
8
9 fn main() {
10 let xs = (0..8).map(|i| i == 1u64).collect::<Vec<_>>();
11 assert_eq!(xs[1], true);
12 let xs = (0..8).map(|i| 1u64 == i).collect::<Vec<_>>();
13 assert_eq!(xs[1], true);
14 let xs: Vec<u8> = (0..10).collect();
15 assert_eq!(xs.len(), 10);
16
17 for x in 0..10 { x % 2; }
18 for x in 0..100 { x as f32; }
19
20 let array = [true, false];
21 for i in 0..1 { array[i]; }
22 }