]>
Commit | Line | Data |
---|---|---|
85aaf69f SL |
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 | // Regression test for type inference failure around shifting. In this | |
c34b1796 | 12 | // case, the iteration yields an isize, but we hadn't run the full type |
85aaf69f SL |
13 | // propagation yet, and so we just saw a type variable, yielding an |
14 | // error. | |
15 | ||
c34b1796 AL |
16 | // pretty-expanded FIXME #23616 |
17 | ||
85aaf69f SL |
18 | trait IntoIterator { |
19 | type Iter: Iterator; | |
20 | ||
21 | fn into_iter(self) -> Self::Iter; | |
22 | } | |
23 | ||
24 | impl<I> IntoIterator for I where I: Iterator { | |
25 | type Iter = I; | |
26 | ||
27 | fn into_iter(self) -> I { | |
28 | self | |
29 | } | |
30 | } | |
31 | ||
32 | fn desugared_for_loop_bad(byte: u8) -> u8 { | |
33 | let mut result = 0; | |
62682a34 | 34 | let mut x = IntoIterator::into_iter(0..8); |
85aaf69f SL |
35 | let mut y = Iterator::next(&mut x); |
36 | let mut z = y.unwrap(); | |
37 | byte >> z; | |
38 | 1 | |
39 | } | |
40 | ||
41 | fn main() {} |