Possible unsoundness in `sort` function
mexus opened this issue · comments
First of all, thanks for the cool and useful crate :)
There's a transmute of [T]
to [FloatOrd<T>]
on https://github.com/notriddle/rust-float-ord/blob/master/src/lib.rs#L71, but this only make sense if FloatOrd
is a "transparent" wrapper: https://doc.rust-lang.org/nomicon/other-reprs.html#reprtransparent
While currently rustc doesn't add any padding to the generated struct, but theoretically in a future release the compiler might start to twist the layout without further notice.
To stay on the safe, I propose to add a #[transparent]
attribute to the FloatOrd
definition.
Thanks!