Closed
Description
In the implementation of Arc
, we find:
Lines 258 to 269 in 09ab31b
Lines 2288 to 2304 in 09ab31b
(And similarly in rc.rs
with struct RcBox
.)
Note the comment: Because it is ?Sized, it will always be the last field in memory.
Is this actually true, even for instantiations where T
happens to be Sized
? Does the language guarantee that there exist no type Foo
such that the fields of ArcInner<Foo>
would be re-ordered?
Or do we need to add #[repr(C)]
to ArcInner
and RcBox
?
CC @rust-lang/wg-unsafe-code-guidelines