-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Implement RFC #1725 (read_unaligned, write_unaligned) #38309
Conversation
70726f3
to
3fa0724
Compare
copy_nonoverlapping(&src as *const T as *const u8, | ||
dst as *mut u8, | ||
mem::size_of::<T>()); | ||
} |
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.
This consumes src
and must forget src
here. This calls for a test!
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.
lol, the RFC forgot to even talk about ownership semantics. Following how ptr::write
works is the obvious thing.
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.
Fixed and added a test.
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.
Great
(I was just chasing another PR that didn't have anything recognizable in the name.. so I took the liberty of adding to the name here.) |
@bors r=alexcrichton |
📌 Commit 75fe727 has been approved by |
Implement RFC #1725 (read_unaligned, write_unaligned) cc #37955 r? @alexcrichton
cc #37955
r? @alexcrichton