Skip to content

Commit 53635e5

Browse files
authored
Rollup merge of #134408 - rmehri01:rpit-inherits-lifetime, r=compiler-errors
Regression test for RPIT inheriting lifetime from projection Regression test to close #51525
2 parents 264566f + a7f61ca commit 53635e5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: tests/ui/impl-trait/rpit/inherits-lifetime.rs

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//! Check that lifetimes are inherited in RPIT.
2+
//! Previously, the hidden lifetime of T::Bar would be overlooked
3+
//! and would instead end up as <T as Foo<'static>>::Bar.
4+
//!
5+
//! Regression test for <https://github.com/rust-lang/rust/issues/51525>.
6+
7+
//@ check-pass
8+
9+
trait Foo<'a> {
10+
type Bar;
11+
}
12+
13+
impl<'a> Foo<'a> for u32 {
14+
type Bar = &'a ();
15+
}
16+
17+
fn baz<'a, T>() -> impl IntoIterator<Item = T::Bar>
18+
where
19+
T: Foo<'a>,
20+
{
21+
None
22+
}
23+
24+
fn main() {}

0 commit comments

Comments
 (0)