Allow unsized types for OnceBox and OnceRef
neoeinstein opened this issue · comments
Marcus Griep commented
Because both of these types are held behind a reference, they should be able to accept unsized types, allowing for things like OnceBox<str>
or OnceBox<'static, str>
.
Alex Kladov commented
I am not sure that'll work: we use pointer CAS in the implementation, so we need the pointer to be a narrow one.
Andrew Walbran commented
Being able to use OnceBox<dyn MyTrait>
or OnceRef<dyn MyTrait>
would also be useful, and seems to be blocked for the same reason.
Alex Kladov commented
Yeah, I don't think this could work