Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's wildly unsound, as far as I can tell.
UnsafeCell/unsafe impl Send/unsafe impl Syncis very dodgy.MaybeUninit<[T; N]>is completely wrong. It should be[<MaybeUninit<T>; N>], which allows for partial initialization.write/assume_initwithMaybeUninit, which is UB.The alternative is to use
#[address_space(shared) static mut [MaybeUninit<T>; N]directly instead. That avoids all the unsoundness, and is more ergonomic because you don't have to work with a raw pointer, and is clearer because details aren't hidden within the macro.I moved (with some modifications) the comments on
shared_arrayto theaddress_spaceproc macro because there were some useful details in there.