On 13-07-18 06:36 AM, Benjamin Striegel wrote:
I agree that this is a huge headache waiting to happen. It's our own
version of the const-correctness problem.

It also occurs with other "obvious utility impls" like totalord and iterbytes, when someone decides to use a struct as a key in a hash or tree map without the person who made that struct picturing that use case.

You can kinda work around these by doing a newtype struct, but it's clunky. And you can only do so if the struct you're wrapping has all-public fields.

I'm hitting this in workcache and json now. Stuff that the author didn't think to make cloneable or comparable impls for. Since I'm in the same source tree now I can fix it, but if it was in a different crate I didn't control, I'd be out of luck.

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to