1 // Test that we reliably check the value of the associated type.
4 #![no_implicit_prelude]
6 use std::option::Option::{self, None, Some};
12 fn next(&mut self) -> Option<Self::Item>;
15 fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {}
22 impl<T, I> Iterator for Adapter<I> where I: Iterator<Item=Option<T>> {
25 fn next(&mut self) -> Option<T> {
30 fn test_adapter<T, I: Iterator<Item=Option<T>>>(it: I) {
31 is_iterator_of::<Option<T>, _>(&it); // Sanity check
32 let adapter = Adapter { iter: it, found_none: false };
33 is_iterator_of::<T, _>(&adapter); // OK
34 is_iterator_of::<Option<T>, _>(&adapter); //~ ERROR type mismatch