Skip to content
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

Closed
abonander opened this issue Apr 24, 2015 · 1 comment
Closed

std::rc::try_unwrap() should only consider the strong refcount #24789

abonander opened this issue Apr 24, 2015 · 1 comment

Comments

@abonander
Copy link
Contributor

From this reddit thread.

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.

@abonander abonander changed the title std::rc::try_unwrap() should only consider the strong refcount to be congruent with Rc's Drop impl std::rc::try_unwrap() should only consider the strong refcount Apr 24, 2015
@SimonSapin
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants