2 #![allow(unused_imports)]
3 // Test for an ICE that occurred when a default method implementation
4 // was applied to a type that did not meet the prerequisites. The
5 // problem occurred specifically because normalizing
6 // `Self::Item::Target` was impossible in this case.
9 use std::marker::Sized;
10 use std::clone::Clone;
12 use std::option::Option;
13 use std::option::Option::{Some,None};
18 fn next(&mut self) -> Option<Self::Item>;
20 fn clone_first(mut self) -> Option<<Self::Item as Deref>::Target> where
23 <Self::Item as Deref>::Target: Clone,
25 self.next().map(|x| x.clone())
37 impl Iterator for Counter {
40 fn next(&mut self) -> Option<Token> {
43 Some(Token { value: x })
48 let mut x: Box<dyn Iterator<Item=Token>> = Box::new(Counter { value: 22 });
49 assert_eq!(x.next().unwrap().value, 22);