Skip to content

Commit 77f2694

Browse files
authored
Rollup merge of rust-lang#63577 - meffij:test-hrtb, r=alexcrichton
Test HRTB issue accepted by compiler Hi! First Rust PR, so if anything needs changing just let me know and I'll take care of it right away. Closes rust-lang#50301 which was marked E-needstest
2 parents b1bbd52 + e5017de commit 77f2694

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/ui/issues/issue-50301.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

0 commit comments

Comments
 (0)