]> git.lizzy.rs Git - rust.git/blob - tests/ui/specialization/issue-36804.rs
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / specialization / issue-36804.rs
1 // check-pass
2 #![feature(specialization)] //~ WARN the feature `specialization` is incomplete
3
4 pub struct Cloned<I>(I);
5
6 impl<'a, I, T: 'a> Iterator for Cloned<I>
7 where
8     I: Iterator<Item = &'a T>,
9     T: Clone,
10 {
11     type Item = T;
12
13     fn next(&mut self) -> Option<T> {
14         unimplemented!()
15     }
16
17     default fn count(self) -> usize where Self: Sized {
18         self.fold(0, |cnt, _| cnt + 1)
19     }
20 }
21
22 impl<'a, I, T: 'a> Iterator for Cloned<I>
23 where
24     I: Iterator<Item = &'a T>,
25     T: Copy,
26 {
27     fn count(self) -> usize {
28         unimplemented!()
29     }
30 }
31
32 fn main() {
33     let a = [1,2,3,4];
34     Cloned(a.iter()).count();
35 }