]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/issue-50301.rs
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
[rust.git] / src / test / ui / associated-types / issue-50301.rs
1 // Tests that HRTBs are correctly accepted -- https://github.com/rust-lang/rust/issues/50301
2 // check-pass
3 trait Trait
4 where
5     for<'a> &'a Self::IntoIter: IntoIterator<Item = u32>,
6 {
7     type IntoIter;
8     fn get(&self) -> Self::IntoIter;
9 }
10
11 struct Impl(Vec<u32>);
12
13 impl Trait for Impl {
14     type IntoIter = ImplIntoIter;
15     fn get(&self) -> Self::IntoIter {
16         ImplIntoIter(self.0.clone())
17     }
18 }
19
20 struct ImplIntoIter(Vec<u32>);
21
22 impl<'a> IntoIterator for &'a ImplIntoIter {
23     type Item = <Self::IntoIter as Iterator>::Item;
24     type IntoIter = std::iter::Cloned<std::slice::Iter<'a, u32>>;
25     fn into_iter(self) -> Self::IntoIter {
26         (&self.0).into_iter().cloned()
27     }
28 }
29
30 fn main() {
31 }