Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligned structs in packed structs #3060

Open
mahkoh opened this issue Jan 11, 2021 · 0 comments
Open

Aligned structs in packed structs #3060

mahkoh opened this issue Jan 11, 2021 · 0 comments

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Jan 11, 2021

The packed struct cgw_frame_mod in the linux kernel api contains the aligned struct can_frame. This cannot be written in Rust because

packed type cannot transitively contain a `#[repr(align)]` type

@alexcrichton, @nikomatsakis, and @retep998 discussed this issue in #1358 and the decision was to disallow this.

But this restriction is unnecessary for repr(C) types. For repr(C) types, the layout is the layout defined by the C target environment. That environment is determined by the target 4-tuple.

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

No branches or pull requests

1 participant