rust-analyzer / rowan

Apache License 2.0
697 stars 57 forks source link

size assert not compatible with randomized struct layouts #168

Open the8472 opened 2 weeks ago

the8472 commented 2 weeks ago

https://github.com/rust-analyzer/rowan/blob/73ed5e7c331c2bedcf9f022e9681fc4784385dda/src/green/node.rs#L30-L31

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. https://github.com/rust-lang/rust/pull/101339