In,
trait BitIter {
type Iter: Iterator<Item=bool>;
pub fn bit_iter(self) -> <Self as BitIter>::Iter;
}
pub fn test_bad<Sym: BitIter>(sym: Sym) {
let i = sym.bit_iter();
}
pub fn test_good<Sym: BitIter>(sym: Sym)
where <Sym as BitIter>::Iter: Iterator<Item=bool> {
let i = sym.bit_iter();
}
pub fn main() {}
test_bad fails to compile, despite the bounds on BitIter::Iter with,
hi.rs:7:17: 7:27 error: type mismatch resolving `<<Sym as BitIter>::Iter as core::iter::Iterator>::Item == bool`: expected associated type, found bool
hi.rs:7 let i = sym.bit_iter();
^~~~~~~~~~
In,
test_badfails to compile, despite the bounds onBitIter::Iterwith,