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.
Instead of storing
MaybeUninit<T>inRooted<T>, and initializingRootedGuardfrom a&mut Rooted<T>, storeTinRooted<T>and initializeRootedGuardfrom an&mut MaybeUninit<Rooted<T>>.Currently every time we touch the data through
RootedGuard<T>, we need to re-assert to the compiler that it is initialized. Adding one more thing to think about in an already complicated safety dance. By instead getting rid of the half initialized state, and passing the entire place in as uninitialized memory, this part of initialization can happen through entirely safe functions, and access never needs to worry about it.Correctly mark
ValueArray::get_ptras safe - it's doing things with the pointer that might be unsafe.This lets us drop the unsafe block in
fn from(array: &Rooted<ValueArray<N>>) -> JS::HandleValueArrayRename
Rooted::ptrtoRooted::data, whenever working with this type viaRootedGuard, we currently have a pointer to a field nameptrwhich is in fact not (necessarily) a pointer. This is... confusing. Let's change the name to something else.None of these changes are necessary for correctness or anything, they would just make me happier when reading the code.
Servo still builds with this change, we're technically changing public APIs, but not ones that are actually directly used.