Update comments and add tests for -Zrandomize-layout for some guaranteed ZSTs#157905
Open
zachs18 wants to merge 2 commits into
Open
Update comments and add tests for -Zrandomize-layout for some guaranteed ZSTs#157905zachs18 wants to merge 2 commits into
-Zrandomize-layout for some guaranteed ZSTs#157905zachs18 wants to merge 2 commits into
Conversation
-Zrandomize-layout for some guaranteed ZSTs
Contributor
|
@rustbot label +A-ZST "+-Zrandomize-layout" |
Contributor
|
Would it make sense to add tests for this? |
zachs18
force-pushed
the
randomize-layout-zst-note
branch
2 times, most recently
from
June 17, 2026 09:28
63e9672 to
57b4ab5
Compare
-Zrandomize-layout for some guaranteed ZSTs-Zrandomize-layout for some guaranteed ZSTs
zachs18
force-pushed
the
randomize-layout-zst-note
branch
from
June 17, 2026 09:36
57b4ab5 to
78ea28b
Compare
…d ZST struct/enums. Also add tests for the guaranteed types.
zachs18
force-pushed
the
randomize-layout-zst-note
branch
from
July 8, 2026 01:57
78ea28b to
bec5d88
Compare
Contributor
Author
|
FCP completed in rust-lang/reference#2293 (comment) , so marking this ready for review |
zachs18
marked this pull request as ready for review
July 19, 2026 13:21
Collaborator
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
davidtwco
approved these changes
Jul 23, 2026
Member
|
@bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2026
… r=davidtwco Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs See rust-lang/reference#2262 . T-lang wants to make some additional guarantees about zero-sized `repr(Rust)` structs and enums, that changes to `-Zrandomize-layout` could theoretically break in the future. This PR adds comments to `-Zrandomize-layout`'s implementation and tests to `tests/ui/layout/randomize.rs` to prevent breaking those guarantees. First commit is the guarantees that T-lang already FCP'd in rust-lang/reference#2262 . Second commit is an additional guarantee (that zero-variant repr(Rust) enums are ZSTs) that's at rust-lang/reference#2293 (FCP now completed)
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2026
… r=davidtwco Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs See rust-lang/reference#2262 . T-lang wants to make some additional guarantees about zero-sized `repr(Rust)` structs and enums, that changes to `-Zrandomize-layout` could theoretically break in the future. This PR adds comments to `-Zrandomize-layout`'s implementation and tests to `tests/ui/layout/randomize.rs` to prevent breaking those guarantees. First commit is the guarantees that T-lang already FCP'd in rust-lang/reference#2262 . Second commit is an additional guarantee (that zero-variant repr(Rust) enums are ZSTs) that's at rust-lang/reference#2293 (FCP now completed)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
Rollup of 18 pull requests Successful merges: - #138618 (Support using const pointers in asm `const` operand) - #150161 (Remove 'static requirement on try_as_dyn) - #158362 (trait solver: account for universes from replace_bound_vars) - #159173 (Add allowed list check on EII implementations attributes) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #159718 (Make `DocLinkResMap` an `FxIndexMap`) - #155795 (constify `vec![1, 2, 3]` macro) - #157776 (ci: Enable autodiff tests on x86_64 linux) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations)
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2026
… r=davidtwco Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs See rust-lang/reference#2262 . T-lang wants to make some additional guarantees about zero-sized `repr(Rust)` structs and enums, that changes to `-Zrandomize-layout` could theoretically break in the future. This PR adds comments to `-Zrandomize-layout`'s implementation and tests to `tests/ui/layout/randomize.rs` to prevent breaking those guarantees. First commit is the guarantees that T-lang already FCP'd in rust-lang/reference#2262 . Second commit is an additional guarantee (that zero-variant repr(Rust) enums are ZSTs) that's at rust-lang/reference#2293 (FCP now completed)
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 23, 2026
… r=davidtwco Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs See rust-lang/reference#2262 . T-lang wants to make some additional guarantees about zero-sized `repr(Rust)` structs and enums, that changes to `-Zrandomize-layout` could theoretically break in the future. This PR adds comments to `-Zrandomize-layout`'s implementation and tests to `tests/ui/layout/randomize.rs` to prevent breaking those guarantees. First commit is the guarantees that T-lang already FCP'd in rust-lang/reference#2262 . Second commit is an additional guarantee (that zero-variant repr(Rust) enums are ZSTs) that's at rust-lang/reference#2293 (FCP now completed)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
Rollup of 19 pull requests Successful merges: - #150161 (Remove 'static requirement on try_as_dyn) - #158362 (trait solver: account for universes from replace_bound_vars) - #159173 (Add allowed list check on EII implementations attributes) - #159466 (cmse: clear variant-dependent padding in `enum`s) - #159718 (Make `DocLinkResMap` an `FxIndexMap`) - #155795 (constify `vec![1, 2, 3]` macro) - #157776 (ci: Enable autodiff tests on x86_64 linux) - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs) - #158766 (Promote riscv64-unknown-linux-musl to tier 2 with host tools) - #159041 (Reorganize `tests/ui/issues` [22/N]) - #159108 (Reorganize `tests/ui/issues` [23/N]) - #159138 (doc: document wasm import symbol mangling) - #159531 (Reorganize `tests/ui/issues` [28/N]) - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable) - #159612 (Reorganize `tests/ui/issues` [29/N]) - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`) - #159667 (Make some parser structured suggestions verbose and tweak their wording) - #159759 (rustc-dev-guide subtree update) - #159761 (Remove outdated comment for resolve_vars_with_obligations)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See rust-lang/reference#2262 . T-lang wants to make some additional guarantees about zero-sized
repr(Rust)structs and enums, that changes to-Zrandomize-layoutcould theoretically break in the future. This PR adds comments to-Zrandomize-layout's implementation and tests totests/ui/layout/randomize.rsto prevent breaking those guarantees.First commit is the guarantees that T-lang already FCP'd in rust-lang/reference#2262 .
Second commit is an additional guarantee (that zero-variant repr(Rust) enums are ZSTs) that's at rust-lang/reference#2293 (FCP now completed)