-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-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
I tried this code:
pub trait A {}
pub trait B where for<'a> &'a Self: A {}
pub trait C<X: B> {}
pub trait D<X: B> where for<'a> &'a X: A {}I expected it to compile. However, while D works just fine, C produces the following error:
error[E0277]: the trait bound `for<'a> &'a X: A` is not satisfied
--> src/lib.rs:3:16
|
3 | pub trait C<X: B> {}
| ^ the trait `for<'a> A` is not implemented for `&'a X`
|
note: required by a bound in `B`
--> src/lib.rs:2:37
|
2 | pub trait B where for<'a> &'a Self: A {}
| ^ required by this bound in `B`
For more information about this error, try `rustc --explain E0277`.
This fails in all versions currently available in playground.
My original use case was requiring an operator to be implemented on references.
Metadata
Metadata
Assignees
Labels
A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-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.