We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug
The code generated by deriving Hash for generic enumerations leads to issues with type inference.
Hash
To Reproduce
#[derive(derivative::Derivative)] #[derivative(Hash)] enum Enumeration<T> { Variant(T), }
Expected behavior
I expect valid code akin to the example below to be generated
impl<T: Hash> Hash for Enumeration<T> { fn hash<H: Hasher>(&self, state: &mut H) { use Enumeration::*; match self { Variant(t) => t.hash(state), } discriminant(self).hash(state); } }
Errors
error[E0282]: type annotations needed --> src/test.rs:3:6 | 3 | enum Enumeration<T> { | ______^ 4 | | Variant(T), | |___________^ cannot infer type for type parameter `T` declared on the enum `Enumeration`
Version (please complete the following information):
rustup --version rustup 1.21.1 (2020-02-23) cargo --version cargo 1.43.0-nightly (bda50510d 2020-03-02) rustc --version rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
derivative
Additional context
N/A
The text was updated successfully, but these errors were encountered:
enums
Thanks for the report and the example!
This should now be fixed in v2.1.0.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
The code generated by deriving
Hash
for generic enumerations leads to issues with type inference.To Reproduce
Expected behavior
I expect valid code akin to the example below to be generated
Errors
Version (please complete the following information):
derivative
: 2.0.2Additional context
N/A
The text was updated successfully, but these errors were encountered: