]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/range-type-infer.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / range-type-infer.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Make sure the type inference for the new range expression work as
12 // good as the old one. Check out issue #21672, #21595 and #21649 for
13 // more details.
14
15 // pretty-expanded FIXME #23616
16
17 fn main() {
18     let xs = (0..8).map(|i| i == 1u64).collect::<Vec<_>>();
19     assert_eq!(xs[1], true);
20     let xs = (0..8).map(|i| 1u64 == i).collect::<Vec<_>>();
21     assert_eq!(xs[1], true);
22     let xs: Vec<u8> = (0..10).collect();
23     assert_eq!(xs.len(), 10);
24
25     for x in 0..10 { x % 2; }
26     for x in 0..100 { x as f32; }
27
28     let array = [true, false];
29     for i in 0..1 { array[i]; }
30 }