forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression test for RPIT inheriting lifetime
- Loading branch information
Showing
1 changed file
with
24 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,24 @@ | ||
//! Check that lifetimes are inherited in RPIT. | ||
//! Previously, the hidden lifetime of T::Bar would be overlooked | ||
//! and would instead end up as <T as Foo<'static>>::Bar. | ||
//! | ||
//! Regression test for <https://github.com/rust-lang/rust/issues/51525>. | ||
//@ check-pass | ||
|
||
trait Foo<'a> { | ||
type Bar; | ||
} | ||
|
||
impl<'a> Foo<'a> for u32 { | ||
type Bar = &'a (); | ||
} | ||
|
||
fn baz<'a, T>() -> impl IntoIterator<Item = T::Bar> | ||
where | ||
T: Foo<'a>, | ||
{ | ||
None | ||
} | ||
|
||
fn main() {} |