-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Replace many uses of mem::transmute
with more specific functions
#27252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
I think this might be getting a little too ambitious with the additions to the public APIs of these types. The |
@alexcrichton |
Could this be split into separate PRs? Landing removal of |
@alexcrichton |
@@ -389,6 +389,7 @@ impl<K, V> Node<K, V> { | |||
|
|||
#[inline] | |||
pub fn as_slices_internal_mut<'b>(&'b mut self) -> MutNodeSlice<'b, K, V> { | |||
// TODO: Bad: This relies on structure layout! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't pass make tidy
(due to the TODO). Could you remove this and perhaps it can be just handled later?
☔ The latest upstream changes (presumably #27012) made this pull request unmergeable. Please resolve the merge conflicts. |
Needs a rebase and travis is mad. |
d2ec989
to
a6bd9fc
Compare
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
c8dbd85
to
2ec2668
Compare
@alexcrichton |
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`. This builds upon #27233.
The replacements are functions that usually use a single
mem::transmute
in their body and restrict input and output via more concrete types thanT
andU
. Worth noting are thetransmute
functions for slices and thefrom_utf8*
family for mutable slices. Additionally,mem::transmute
was often used for casting raw pointers, when you can already cast raw pointers just fine withas
.This builds upon #27233.