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

size assert not compatible with randomized struct layouts #168

Open
the8472 opened this issue Aug 31, 2024 · 0 comments
Open

size assert not compatible with randomized struct layouts #168

the8472 opened this issue Aug 31, 2024 · 0 comments

Comments

@the8472
Copy link

the8472 commented Aug 31, 2024

rowan/src/green/node.rs

Lines 30 to 31 in 73ed5e7

#[cfg(target_pointer_width = "64")]
static_assert!(mem::size_of::<GreenChild>() == mem::size_of::<usize>() * 2);

breaks when compiling with layout randomization

If the assert is necessary for correctness then repr(C) should be used on the struct and its children to get deterministic layouts.
If it's just an optimization then it's probably better to just check it in tests/CI.

Found this while trying to build the rust compiler with randomized layouts. rust-lang/rust#101339

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

No branches or pull requests

1 participant