-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #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 #50301 which was marked E-needstest
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Tests that HRTBs are correctly accepted -- https://github.com/rust-lang/rust/issues/50301 | ||
// check-pass | ||
trait Trait | ||
where | ||
for<'a> &'a Self::IntoIter: IntoIterator<Item = u32>, | ||
{ | ||
type IntoIter; | ||
fn get(&self) -> Self::IntoIter; | ||
} | ||
|
||
struct Impl(Vec<u32>); | ||
|
||
impl Trait for Impl { | ||
type IntoIter = ImplIntoIter; | ||
fn get(&self) -> Self::IntoIter { | ||
ImplIntoIter(self.0.clone()) | ||
} | ||
} | ||
|
||
struct ImplIntoIter(Vec<u32>); | ||
|
||
impl<'a> IntoIterator for &'a ImplIntoIter { | ||
type Item = <Self::IntoIter as Iterator>::Item; | ||
type IntoIter = std::iter::Cloned<std::slice::Iter<'a, u32>>; | ||
fn into_iter(self) -> Self::IntoIter { | ||
(&self.0).into_iter().cloned() | ||
} | ||
} | ||
|
||
fn main() { | ||
} |