Open fitzgen opened 3 years ago
I'd be happy to implement this! To clarify, is the idea to have the return type for those two functions use &[MaybeUninit<u8>]
instead of NonNull<u8>
?
That makes more sense to me than MaybeUninit<&[u8]>
because the slice's metadata is initialized (e.g. its length is available without unsafe
), it's just the bytes that aren't.
I'd be happy to implement this! To clarify, is the idea to have the return type for those two functions use
&[MaybeUninit<u8>]
instead ofNonNull<u8>
?That makes more sense to me than
MaybeUninit<&[u8]>
because the slice's metadata is initialized (e.g. its length is available withoutunsafe
), it's just the bytes that aren't.
That is correct.
However I don't think we actually want to implement this until we're ready for a breaking change to bumpalo
, which probably won't be until std
supports custom allocators or some other really well motivated reason.
We would also want to double check that this change doesn't regress the performance of allocation, since all the allocation APIs are built on top of these methods.
MaybeUninit
wasn't stable when these APIs were added. Now it is.Note that this is a breaking change and will require a version bump.