-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
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
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.