Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

transmute_copy should not have alignment requirements #14

Closed
arielb1 opened this issue Aug 22, 2016 · 4 comments
Closed

transmute_copy should not have alignment requirements #14

arielb1 opened this issue Aug 22, 2016 · 4 comments

Comments

@arielb1
Copy link
Contributor

arielb1 commented Aug 22, 2016

std::mem::transmute_copy should work on unaligned pointers, unlike dereferences and ptr::read.

@arielb1 arielb1 added the T-libs label Aug 22, 2016
@Amanieu
Copy link
Member

Amanieu commented Aug 22, 2016

cc rust-lang/rfcs#1703

@newpavlov
Copy link

This issue is fixed, see the referenced issue.

@RalfJung
Copy link
Member

It turns out indeed that transmute_copy uses read_unaligned. I had no idea. That might be worth calling out in its documentation?

Note that the reference still needs to be T-aligned, as all references do. But it does not have to be U-aligned.

@newpavlov
Copy link

It was changed in rust-lang/rust#55052.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants