-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
enhancementNew feature or requestNew feature or request
Description
packed structs worked before db96c51, which is unsound. After that commit, packed structs stopped working, because the field accessors are references and they resulted in an error by the compiler. We then added explicit support for packed structs in 71988db by providing a way to not emit these field accessors. This is unsound, since the entire architecture of pin-init relies on aligned pointers. We thus removed the support again in #111.
To support packed structs there are two possibilities:
- Extend the current trait infrastructure with new ones:
- Add new traits
Unaligned[Pin]Initthat relax the alignment requirement of their pointer - Add an attribute to
init!to make it emit such an initializer instead (taking care of field accessors, only usingptr::write_unalignedand also expecting unaligned initializers)
- Extend the current
[Pin]Inittraits:
- Extend the
Inittrait with an associated boolean constant that specifies if the pointer must be aligned or not - Make the
init!macro propagate this constant & ensure correct behavior based on it
Both of these seem quite invasive. So I'd like to wait and see for a real use-case of packed structs with pin-init that cannot easily work around it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request