tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.14k stars 111 forks source link

loom::arc::Arc::Inner is not repr(C) #231

Closed tower120 closed 3 years ago

tower120 commented 3 years ago

You depend on the fact that struct Arc::Inner::value is first in the Arc::Inner struct. So you never add member-field offset in into_raw / from_raw. https://github.com/tokio-rs/loom/blob/d25c5e3cd23cbbac5e0302833b1056ccf39e2f94/src/sync/arc.rs#L12-L18

Shouldn't Arc::Inner have #[repr(C)] attribute? As far as I know Rust can rearrange field positions at will, with default #repr...

Darksonn commented 3 years ago

You are completely correct. Please go ahead and include it in your other PR.