Consider alignment when computing into_raw#138
Conversation
This commit fixes taiki-e#137 by considering alignment when converting the raw Arc pointer to and raw its raw representation. Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
|
Published in 0.1.4 & yanked old versions. |
|
FYI: I believe the new logic is still not entirely correct, at least not for arbitrary "header" and "value" types. In particular, it fails if This probably isn't a significant problem right now because |
|
@TimNN Thanks for the heads up! We don't want to define a general-purpose offset_of (we should use memoffset crate for that use case) and it would be sufficient to adopt a way that works correctly for the specific headers we use. That said, we would at least need to add a comment about the fact that the current implementation also relies on the actual properties of the header. Ideally I would like to use the same way that std::sync::Arc uses (e.g., padding_needed_for), but that is unstable... EDIT: #141 changed it to use the same way as std::sync::Arc. |
This commit fixes #137 by considering alignment when converting the raw
Arc pointer to and raw its raw representation.