From a7f61cad1e6735b7f6a522ee1a3bc96c4e9ab1c7 Mon Sep 17 00:00:00 2001 From: Ryan Mehri Date: Mon, 16 Dec 2024 22:53:21 -0700 Subject: [PATCH] Regression test for RPIT inheriting lifetime --- tests/ui/impl-trait/rpit/inherits-lifetime.rs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/ui/impl-trait/rpit/inherits-lifetime.rs diff --git a/tests/ui/impl-trait/rpit/inherits-lifetime.rs b/tests/ui/impl-trait/rpit/inherits-lifetime.rs new file mode 100644 index 0000000000000..60c2a96c8737b --- /dev/null +++ b/tests/ui/impl-trait/rpit/inherits-lifetime.rs @@ -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 >::Bar. +//! +//! Regression test for . + +//@ check-pass + +trait Foo<'a> { + type Bar; +} + +impl<'a> Foo<'a> for u32 { + type Bar = &'a (); +} + +fn baz<'a, T>() -> impl IntoIterator +where + T: Foo<'a>, +{ + None +} + +fn main() {}