rust
rust copied to clipboard
regression with the new opaque type generics
The following should compile.
#![feature(type_alias_impl_trait)]
#![allow(unconditional_recursion)]
type Opaque<'a> = impl Sized + 'a;
fn test<'a>() -> Opaque<'a> {
let _: () = test::<'a>();
//~^ ERROR expected generic lifetime parameter, found `'_`
}
Regressed in #122103. With the new generics of Opaque, the defining use at the let statement is Opaque<'_, 'a> := (). Cc @compiler-errors
You minimized this from the same issue we have with RPITs, right? Because this code ICEs:
#![allow(unconditional_recursion)]
fn test<'a>() -> impl Sized + 'a {
let _: () = test::<'a>();
}
No, I discovered it accidentally by rebasing #116891.
Wait, @aliemjay isn't this issue also fixed by #116891? It should be filtering out the uncaptured lifetimes in that PR.