MaybeUninit for unsized types?

What is blocking allowing unsized types within a MaybeUninit? If this has already been discussed, then perhaps someone could point me to the discussion.

The reason for wanting it is to implement an unsized enum, and the reason for wanting that is to allow Actor<dyn Trait> in Stakker, where Actor<A> could be modelled (for illustration) as something along the lines of Rc<RefCell<(Base, Option<A>)>>. I've written a crate to do what I want, which I hope is sound, although it uses ManuallyDrop.

If the problem is planning ahead for thin pointers, then I wonder whether just discussing that enough to prove that having unsized enums/unions/etc would not conflict with that would unblock the feature. For example, with a thin pointer, there are a lot of places where the vtable pointer could go, e.g. right next to the unsized value, or anywhere back from there to the start of the object that is pointed to. Could this be made explicit with a Vtabled<Inner> type that puts the vtable pointer exactly at that point? (where Inner would be some type that ends with a DST). Then that (hopefully) would get rid of the worry about needing to integrate the vtable into enum/union/etc one day.

1 Like