Skip to content

type-layout: rewrite #[repr(C)] struct layout algorithm#2243

Open
DanielEScherzer wants to merge 1 commit intorust-lang:masterfrom
DanielEScherzer:type-layout-algo
Open

type-layout: rewrite #[repr(C)] struct layout algorithm#2243
DanielEScherzer wants to merge 1 commit intorust-lang:masterfrom
DanielEScherzer:type-layout-algo

Conversation

@DanielEScherzer
Copy link
Copy Markdown
Contributor

Make the code actual compile by defining types, not using a variable named struct, adding mut where needed, etc.

Properly handle the max() alignment call returning Option<usize> rather than usize by using 0 for the alignment if there are no fields.

Add comments with the parts of the algorithm that are represented by the statements.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Apr 28, 2026
Make the code actual compile by defining types, not using a variable named
`struct`, adding `mut` where needed, etc.

Properly handle the `max()` alignment call returning `Option<usize>` rather
than `usize` by using 0 for the alignment if there are no fields.

Add comments with the parts of the algorithm that are represented by the
statements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants