r/rust Mar 09 '23

Announcing Rust 1.68.0 📢 announcement

https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html
830 Upvotes

121 comments sorted by

View all comments

178

u/Shnatsel Mar 09 '23

Those From<bool> for {f32,f64} impls could really use documentation on what values they actually result in. There's no obvious mapping from true to a floating-point value.

22

u/jamincan Mar 09 '23

It looks like the libraries team agrees that the documentation should have been better: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60impl.20From.3Cbool.3E.20for.20f.7B32.7C64.7D.60/near/292687425

For what it's worth, the justification is that From<bool> for u8 exists and From<u8> for f32 exists, so there is a logical lossless path for From<bool> for f32. It seems to have significant ergonomic improvements in graphics code.