1 // Tests that HRTBs are correctly accepted -- https://github.com/rust-lang/rust/issues/50301
2 // check-pass
3 // ignore-compare-mode-chalk
4 trait Trait
5 where
6     for<'a> &'a Self::IntoIter: IntoIterator<Item = u32>,
7 {
8     type IntoIter;
get(&self) -> Self::IntoIter9     fn get(&self) -> Self::IntoIter;
10 }
11 
12 struct Impl(Vec<u32>);
13 
14 impl Trait for Impl {
15     type IntoIter = ImplIntoIter;
get(&self) -> Self::IntoIter16     fn get(&self) -> Self::IntoIter {
17         ImplIntoIter(self.0.clone())
18     }
19 }
20 
21 struct ImplIntoIter(Vec<u32>);
22 
23 impl<'a> IntoIterator for &'a ImplIntoIter {
24     type Item = <Self::IntoIter as Iterator>::Item;
25     type IntoIter = std::iter::Cloned<std::slice::Iter<'a, u32>>;
into_iter(self) -> Self::IntoIter26     fn into_iter(self) -> Self::IntoIter {
27         (&self.0).into_iter().cloned()
28     }
29 }
30 
main()31 fn main() {
32 }
33