Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRevSlice requires repr(C) or repr(transparent) #1
Comments
This comment has been minimized.
This comment has been minimized.
|
Yes, that's theoretically true right now, but it may very soon not be: rust-lang/unsafe-code-guidelines#31 (comment) |
This comment has been minimized.
This comment has been minimized.
|
Made it transparent in 0.1.4. Lines 65 to 68 in b555bcd |
scottmcm
closed this
Oct 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dtolnay commentedOct 5, 2018
Without one of those attributes, my understanding is the transmute from &[T] to &RevSlice<T> is undefined behavior. The compiler is free to stick some additional data at the start of RevSlice<T> or give it a stricter alignment than [T]. For example some targets may require all struct types to have some minimum alignment that is not required for slices.
From nomicon's Alternative representations: