Closed as not planned
Closed as not planned
Description
trait Trait {
type Assoc;
}
struct LocalTy;
impl Trait for () {
type Assoc = LocalTy;
}
impl PartialEq for <() as Trait>::Assoc {
fn eq(&self, other: &Self) -> bool {
true
}
}
results in
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
--> src/lib.rs:10:1
|
10 | impl PartialEq for <() as Trait>::Assoc {
| ^^^^^---------^^^^^--------------------
| | | |
| | | `<() as Trait>::Assoc` is not defined in the current crate
| | `<() as Trait>::Assoc` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: define and implement a trait or new type instead
ideally it should mention that <() as Trait>::Assoc
may actually be local to the current crate and that the user could replace that projection with the associated type itself.