Skip to content

DeriveWhere on packed structs causes reference to packed field is unaligned errors. #106

Open
@stegaBOB

Description

@stegaBOB

All of the match statements internally that get references to the fields cause this issue. Currently the std lib detects if the struct is #[repr(packed)] and adds implicit Fields: Copy bounds to the derive and copies out all the fields instead. Serde does something similar. I think it should be relatively* straightforward to add that in here too. I'd be more than happy to PR that in if its something you would be willing to accept.

*it might actually be a bit more complicated. The self match destructuring might need to be replaced for this. Technically possible to add a Self: Copy bound and still match without the refs, but it wouldn't be optimal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions