Skip to content

Randomize the ordering of struct fields when compiling in debug mode #38550

Open
@bstrie

Description

@bstrie

Now that it looks like #28951 will be addressed via #37429 , we may have a further obligation to ensure to do what we can to ensure that this doesn't bite people. One way that we could help out would be to randomize the order of struct fields by default when compiling in debug mode. This would only apply to structs that are not tagged with a #repr, and would effectively act as the #[repr(random)] proposed by @petrochenkov at #37429 (comment) (actually adding explicit #[repr(random)] would probably require an RFC, and so is not a prereq for this issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zrandomize-layoutUnstable option: Randomize the layout of types.A-reproducibilityArea: Reproducible / deterministic buildsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions