-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize Rc<T>::default
#132031
base: master
Are you sure you want to change the base?
Optimize Rc<T>::default
#132031
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
@rustbot author |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Whoa |
CI green. @rustbot ready |
cc @rust-lang/opsem regarding I'm also happy to approve this without the |
The current implementation of Lines 393 to 404 in 86d69c7
And it's also what was suggested in #47336 (comment). |
Alright, this seems reasonable then. Thanks! @bors r+ |
The missing piece of #131460.
Also refactored
Arc<T>::default
by using a safeNonNull::from(Box::leak(_))
to replace the unnecessarily unsafe call toNonNull::new_unchecked(Box::into_raw(_))
. The remaining unsafety is coming from[Rc|Arc]::from_inner
, which is safe from the construction of[Rc|Arc]Inner
.