// Test that we reliably check the value of the associated type. #![crate_type = "lib"] #![no_implicit_prelude] use std::option::Option::{self, None, Some}; use std::vec::Vec; trait Iterator { type Item; fn next(&mut self) -> Option; } fn is_iterator_of>(_: &I) {} struct Adapter { iter: I, found_none: bool, } impl Iterator for Adapter where I: Iterator> { type Item = T; fn next(&mut self) -> Option { loop {} } } fn test_adapter>>(it: I) { is_iterator_of::, _>(&it); // Sanity check let adapter = Adapter { iter: it, found_none: false }; is_iterator_of::(&adapter); // OK is_iterator_of::, _>(&adapter); //~ ERROR type mismatch }