Closed
Description
After seeing #84147 I wondered if it applied to any method call that requires [T; N]: IntoIterator
, but looks like that's not the case. This code compiles fine in rust 1.52, but fails to compile from rust 1.53
trait IterExt {
type Iter: Iterator;
fn it(self) -> Self::Iter;
}
impl<I: IntoIterator> IterExt for I {
type Iter = I::IntoIter;
fn it(self) -> Self::Iter {
self.into_iter()
}
}
fn main() {
let a = [1, 2, 3];
for i in a.it() {
let _: &i32 = i;
}
}
In rust 1.53 it fails with the following error:
error[E0308]: mismatched types
--> <source>:16:23
|
16 | let _: &i32 = i;
| ---- ^
| | |
| | expected `&i32`, found integer
| | help: consider borrowing here: `&i`
| expected due to this
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.