Open
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.