educe
educe copied to clipboard
Fix type inference failures in PartialOrd/Ord impls
Closes #36
Uh, looking at this again, doesn't this comparison assume that the tag is at the start of the enum? I don't think that's guaranteed by anything.
If an enum has opted-in to having a primitive representation for its discriminant, then it’s possible to use pointers to read the memory location storing the discriminant. That cannot be done for enums using the default representation, however, as it’s undefined what layout the discriminant has and where it’s stored — it might not even be stored at all!
https://doc.rust-lang.org/stable/std/mem/fn.discriminant.html#accessing-the-numeric-value-of-the-discriminant
https://doc.rust-lang.org/stable/std/mem/fn.discriminant.html Should be the thing to use here.
@magiclen do you have a chance to look at this? Experiencing breaks from this bug.
+1 also experiencing bugs from this