You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::rc::try_unwrap() returns Err if the Rc is not unique, which includes weak references. This fails intuition as the logic is the same as when the last Rc 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:
abonander
changed the title
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
Apr 24, 2015
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: