Unsafe is no longer necessary as of rustc 1.34 #488
Labels
No labels
breaking
bug
dependencies
good first issue
help wanted
unstable
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-uuid-rs/uuid#488
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This code (and another identical line in the same file) uses unsafe to convert a
&[u8]to a&[u8; 8]:github.com/uuid-rs/uuid@f177d20151/src/lib.rs (L360)From Rust 1.34 and on (before that, TryFrom wasn't stable), the following code compiles to the exact same assembly as the code above:
Tested with rustc 1.34 and 1.45.2 on godbolt.org, with
-O.The
try_intoversion is simpler and doesn't use unsafe, so it'd probably be a good idea to switch to that once support for Rust 1.32/33 is dropped.Our current MSRV is 1.32.0 😞
However I will keep the issue open so we can update the relevant code when we get to it
We've just bumped our MSRV to
1.34.0in #501 with an update togetrandom.Would anybody like to submit a PR for this?