-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
std::rc::try_unwrap()
should only consider the strong refcount
#24789
Comments
abonander
changed the title
Apr 24, 2015
std::rc::try_unwrap()
should only consider the strong refcount to be congruent with Rc
's Drop
implstd::rc::try_unwrap()
should only consider the strong refcount
This is fixed in #27837 and can be closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From this reddit thread.
std::rc::try_unwrap()
returnsErr
if theRc
is not unique, which includes weak references. This fails intuition as the logic is the same as when the lastRc
is dropped, which only considers strong references when deciding whether to drop the contained value, except it keeps the contained value from being destroyed. I fail to see how it is unsafe to unwrap when only weak references remain.The text was updated successfully, but these errors were encountered: