Open
Description
Code
I tried this code:
trait Foo {
type Gat<'a> where Self: 'a;
fn bar(&self) -> Self::Gat<'_>;
}
impl<T: Foo> Foo for Option<T> {
type Gat<'a> = Option<<T as Foo>::Gat<'a>> where Self: 'a;
fn bar(&self) -> Self::Gat<'_> {
self.as_ref().map(Foo::bar)
}
}
Version it worked on
The code is compiled on Rust 1.65
Version with regression
The code is not compiled on current stable(1.66), beta, and nightly with error:
error: `T` does not live long enough
--> src/lib.rs:9:9
|
9 | self.as_ref().map(Foo::bar)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: could not compile `playground` due to previous error