Hi, why doesn't the following compile:
trait A {}
impl<T> Into<usize> for T
where
T: A
{
fn into(self) -> usize {
todo!();
}
}
It fails with the error:
Compiling playground v0.0.1 (/playground)
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> src/lib.rs:3:6
|
3 | impl<T> Into<usize> for T
| ^ type parameter `T` must be used as the type parameter for some local type
|
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
For more information about this error, try `rustc --explain E0210`.
error: could not compile `playground` due to previous error
But the trait A isn't a foreign trait?