Closed
Description
trait DictLike<'a> {
type ItemsIterator: Iterator<Item=u8>;
fn items(&self) -> Self::ItemsIterator;
fn get(&self) {
for k in self.items() {}
// get(self)
}
}
// fn get<'a, X: ?Sized + DictLike<'a>>(x: &X) { for k in x.items() {} }
fn main() {}
<anon>:7:13: 7:14 error: unable to infer enough type information about `_`; type annotations required [E0282]
<anon>:7 for k in self.items() {}
^
Strangely, switching to the commented out form works fine, i.e. just moving the body of the code out of the default method.
Nominating since I am unsure how important we regard inference issues like this to be.