Closed
Description
I have a local type:
#[derive(Debug, Deserialize)]
#[serde(untagged)]
enum BadOption<T> {
Some(T),
None(Value),
}
and I want to impl<T> From<BadOption<T>> for Option<T>
but the error message suggests that T
isn't being used as the type parameter for a local type
type parameter
T
must be used as the type parameter for some local type
Reproduction: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9abd2ab4860140be2859d4767fc027f8
Full error:
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> src/main.rs:11:1
|
11 | impl<T> From<BadOption<T>> for Option<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
|
= note: only traits defined in the current crate can be implemented for a type parameter