Uh oh!
There was an error while loading. Please reload this page.
weak-into-raw: Clarify some details in Safety - #66710
Conversation
rust-highfive
commented
Nov 24, 2019
(rust_highfive has picked a reviewer for you, use r? to override) |
CAD97
left a comment
There was a problem hiding this comment.
Just a couple small notes, this is a good clarification otherwise.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
This isn't perfectly accurate, as you don't have to forget the original weak in the past, you can forget this weak if the pointer is from as_raw.
I'm not sure how to reword this note, though. Probably something along the lines of "only as many Weak are dropped as are created by non-raw methods".
There was a problem hiding this comment.
Technically yes, but only as long as some other Weak<T> or Strong<T> pointing to the same thing exists. If you created it after the weak count dropped to 0 and then forgot it, it would be UB, because it would play with the weak count field that no longer exists.
But if you hold a Weak<T> somewhere, then you probably don't really need to create and forget it. So I believe this might be good enough ‒ especially because this safety section errs on the safe side ‒ it's more restrictive than needs to be.
Anyway, I don't see how to make it more accurate, still readable and not ramble about it over two pages :-(.
vorner
commented
Nov 24, 2019
I've added a fixup. That one should be squashed before merging ‒ I'll do so once it gets completely reviewed. |
Centril
commented
Nov 24, 2019
r? @RalfJung perhaps |
rust-highfive
commented
Nov 24, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Uh oh!
There was an error while loading. Please reload this page.
RalfJung
commented
Nov 24, 2019
I can add this to my queue but given that my next free week-end is sometime in January, don't expect a quick review -- sorry. |
vorner
commented
Nov 25, 2019
There's no code changed, it's just documentation changes to avoid people getting confused by it. I believe quite anyone should be able to review this, following the discussion in the linked ticket. It's not really about some deep unsafe magic. |
It's less about being able to and more about finding the time. I only have 1-2 hours of time for Rust per day (taking up almost my entire free time) and there are quite a few things that are already waiting in my queue for more than a week. |
vorner
commented
Nov 25, 2019
My point was that I don't think it has to be you, @RalfJung, that anyone else could take it instead. |
rust-highfive
commented
Nov 25, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
RalfJung
commented
Nov 25, 2019
What about r? @SimonSapin |
SimonSapin
commented
Nov 29, 2019
Sorry, I’m in a similar situation as Ralf. I’ve removed myself (a while ago) from the review auto-assignment because of limited bandwidth. I don’t really have a suggestion for more precise wording here. r? @Centril |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Centril
commented
Nov 30, 2019
Also, can you squash the commits? |
dtolnay
left a comment
There was a problem hiding this comment.
Looks good to me once squashed, r=me.
3acb622 to
f201e89Comparevorner
commented
Dec 1, 2019
Thank you. I've included the suggestions and squashed. |
rust-highfive
commented
Dec 1, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
vorner
commented
Dec 1, 2019
Ups, I've force-pushed an older version ☹. I'll fix it once I get to the other computer where the right version still lives. |
Centril
commented
Dec 1, 2019
Looks good to me also, but r? @dtolnay |
f201e89 to
196cbfbComparevorner
commented
Dec 3, 2019
I've just squashed and force-pushed the correct version including all the link fixes. 🤞 |
dtolnay
commented
Dec 3, 2019
Thanks! @bors r+ rollup |
bors
commented
Dec 3, 2019
📌 Commit 196cbfb4a6d75b5f6a01d2d33b2e41e02a1ba5f5 has been approved by |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
RalfJung
commented
Dec 3, 2019
Let's fix those typos before landing. @bors r- |
196cbfb to
4731510CompareClarify it is OK to pass a pointer that never owned a weak count (one from Weak::new) back into it as it was created from it. Relates to discussion in rust-lang#60728.
RalfJung
commented
Dec 5, 2019
Thanks! @bors r=dtolnay |
bors
commented
Dec 5, 2019
📌 Commit 4731510 has been approved by |
…tolnay weak-into-raw: Clarify some details in Safety Clarify it is OK to pass a pointer that never owned a weak count (one from Weak::new) back into it as it was created from it. Relates to discussion in rust-lang#60728. @CAD97 Do you want to have a look at the new docs?
Rollup of 9 pull requests Successful merges: - #66710 (weak-into-raw: Clarify some details in Safety) - #66863 (Check break target availability when checking breaks with values) - #67002 (Fix documentation of pattern for str::matches()) - #67005 (capitalize Rust) - #67010 (Accurately portray raw identifiers in error messages) - #67011 (Include a span in more `expected...found` notes) - #67044 (E0023: handle expected != tuple pattern type) - #67045 (rustc_parser: cleanup imports) - #67055 (Make const-qualification look at more `const fn`s) Failed merges: r? @ghost
Clarify it is OK to pass a pointer that never owned a weak count (one
from Weak::new) back into it as it was created from it. Relates to
discussion in #60728.
@CAD97 Do you want to have a look at the new docs?