Rc::make_mut doesn't clone if there are weak refs #60961
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
The docs for Rc::make_mut say:
(See https://doc.rust-lang.org/std/rc/struct.Rc.html#method.make_mut )
As I read the above paragraph, the last line of the following program should not print 'None'. In fact, it does print None, at least on stable rust 1.34.2.
I'm not being bit by this, possibly no-one is. Just thought I should report it.
Edit: The following paragraph didn't make much sense. This is just a doc error. After make_mut has finished, there are no strong refs so the weak refs should just all die anyway. The docs as written don't make sense, the implementation is the only reasonable one.
(If I haven't missed anything, and there actually is a discrepancy between the documentation and the code, what would be the correct solution? Changing the code or the docs?)The text was updated successfully, but these errors were encountered: