# MaybeUninit for unsized types?

**URL:** <https://internals.rust-lang.org/t/maybeuninit-for-unsized-types/12863>\
**Category:** Uncategorized\
**Created:** [August 9, 2020, 4:15pm UTC](https://internals.rust-lang.org/t/maybeuninit-for-unsized-types/12863 "2020-08-09T16:15:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimuazu](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/jimuazu/32/77_2.png) [@jimuazu](https://internals.rust-lang.org/u/jimuazu)\
**Post date:** [August 9, 2020, 4:15pm UTC](https://internals.rust-lang.org/t/maybeuninit-for-unsized-types/12863/1 "2020-08-09T16:15:01Z")

</div>

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](https://crates.io/crates/unsized_enum), 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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [November 7, 2020, 4:15pm UTC](https://internals.rust-lang.org/t/maybeuninit-for-unsized-types/12863/2 "2020-11-07T16:15:06Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
