creusot
creusot copied to clipboard
Deriving `PartialEq` is not supported for enums with more than one variant.
Deriving Eq
works just fine, whereas deriving PartialEq
gives the following error:
thread 'rustc' panicked at 'not implemented', creusot/src/translation/traits.rs:246:14
Example:
#[derive(PartialEq)]
enum Example {
Example,
Example2
}
Do note that this does not error
#[derive(PartialEq)]
enum Example {
Example,
}
and that this does not error
#[derive(Eq)]
enum Example {
Example,
Example2
}
even though Eq
requires PartialEq
The crash is definitely a bug, but derived instances won't be very helpful for you in Creusot as you'd have no contract on their behavior.
You're probably better off manually defining the instances :/ at least then you can add a contract.
Should be supported now that we have a PartialEq
derive.