-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
associated types in generics cause lifetime invariance #115799
Copy link
Copy link
Open
Labels
A-varianceArea: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)C-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-varianceArea: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)C-bugCategory: This is a bug.Category: This is a bug.T-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.
playground
It's not clear to me why
HolderandCovariantHolderare any different. It's not possible construct aCovariantHolder<T, S>whereSis anything other than<T as WithAssoc>::Assoc. Why does the compiler treat them differently?