Description
The discussions at #76 and #77 are about the validity invariant that all references have to maintain in general; this issue here is specifically about the validity invariant of the metadata component of any fat pointer -- which do not have to be references! Rc<[u8]>
is also a fat pointer. The expected metadata depends on the type of the "unsized tail".
For slices, it seems clear that the invariant will be the same as that for usize
. But for dyn Trait
pointers, what should we require about the vtable? My guess would have been at least as much as an &[usize; 3]
(a vtable has at least 3 slots: size, alignment and drop function, not necessarily in that order). But in this forum thread, the valid question came up why Weak::new
does not work for dyn Trait
, and indeed it could if we could "fake" the fat pointer component (though doing that generically seems hard).
And then there is the question how this interacts with eventual custom/user-defined DSTs.