-
Notifications
You must be signed in to change notification settings - Fork 1.6k
What to do with transmute_copy
#1703
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
Comments
Why can't we just add Regarding your point that |
@Amanieu That is my first suggestion. Change the definition to If it is used in the community extensively, I'd like that we change it to |
I'd argue you should use |
I'm however +1 for |
I would rather avoid having I think changing the signature of The main issue that needs to be discussed is what the alignment requirements for the source argument of
|
@Amanieu |
I don't know why this issue got closed in 2017 (@ubsan do you remember?), but 1.5 years later with rust-lang/rust#55052 the implementation got changed to use |
@RalfJung I believe this was closed when I left the Rust community, and didn't want to deal with it. |
Then I guess I can just hope that there's nothing else we lost track of because of issues being closed like that... |
This function is a terror. It is full of undefined behavior, even more than it's sister,
transmute
. The only uses of this function are either Undefined Behavior, aretransmute
s, except that they didn't try, or are justtransmute
s in a generic context.This is unfortunate. I think we should make this function either much more useful, or deprecate it and get rid of the undefined behavior.
Changing the definition to:
would allow us to pull types from byte arrays, for example, without having to do this all by hand.
Otherwise, it should be deprecated, because it isn't really useful enough, and leads to far too many issues; it's only stable because
transmute
was unstable at the time.The text was updated successfully, but these errors were encountered: