Regression test for RPIT inheriting lifetime
This commit is contained in:
parent
13b77c687c
commit
a7f61cad1e
1 changed files with 24 additions and 0 deletions
24
tests/ui/impl-trait/rpit/inherits-lifetime.rs
Normal file
24
tests/ui/impl-trait/rpit/inherits-lifetime.rs
Normal file
|
@ -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() {}
|
Loading…
Add table
Add a link
Reference in a new issue