2018-09-06 12:41:12 +00:00
|
|
|
// run-pass
|
|
|
|
|
2020-05-17 08:22:48 +00:00
|
|
|
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
|
2016-12-04 22:41:13 +00:00
|
|
|
|
|
|
|
trait Iterator {
|
|
|
|
fn next(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
trait WithAssoc {
|
|
|
|
type Item;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> WithAssoc for &'a () {
|
|
|
|
type Item = &'a u32;
|
|
|
|
}
|
|
|
|
|
2022-07-25 20:36:03 +00:00
|
|
|
struct Cloned<I>(#[allow(unused_tuple_struct_fields)] I);
|
2016-12-04 22:41:13 +00:00
|
|
|
|
|
|
|
impl<'a, I, T: 'a> Iterator for Cloned<I>
|
|
|
|
where I: WithAssoc<Item=&'a T>, T: Clone
|
|
|
|
{
|
|
|
|
fn next(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a, I, T: 'a> Iterator for Cloned<I>
|
|
|
|
where I: WithAssoc<Item=&'a T>, T: Copy
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
Cloned(&()).next();
|
|
|
|
}
|