Uh oh!
There was an error while loading. Please reload this page.
Add note about Copy for drop() - #28319
Conversation
steveklabnik
commented
Sep 9, 2015
I've always been a bit wary of introducing things like this into examples, because what people get confused by is always different, and deciding what "obvious" things is hard on each example. But I'm okay with this. |
steveklabnik
commented
Sep 9, 2015
@bors: r+ rollup |
bors
commented
Sep 9, 2015
📌 Commit 1305ab3 has been approved by |
Manishearth
commented
Sep 9, 2015
@bors r=steveklabnik rollup |
bors
commented
Sep 9, 2015
📌 Commit 1305ab3 has been approved by |
mdinger
commented
Sep 10, 2015
@steveklabnik
[EDIT] Added new to the previous line. |
Manishearth
commented
Sep 10, 2015
I think as far as documentation goes copy semantics have always been portrayed as being different from move semantics (not "a move and then a copy") |
mdinger
commented
Sep 10, 2015
No, a copy and then a move. The original is untouched but ownership transference still applies to the new copy. Is there a reason to attempt to separate these two topics otherwise?They're on the same page and move leads directly into copy. It just cements further the idea that ownership move semantics are a pervasive idea. |
steveklabnik
commented
Sep 10, 2015
Yeah, I would say i agree with @mdinger in the sense that we do try to make it explicit that the only difference is the ability to use it after, or at least, if we're not, we should. |
mdinger
commented
Sep 10, 2015
My preference would definitely be the footnote. Then you give them a guiding push in the correct direction and the real location of where this is documented. If they still don't understand, then maybe the regular docs need further improvement too. |
13cf97b to
3299e80CompareManishearth
commented
Sep 21, 2015
@steveklabnik updated |
There was a problem hiding this comment.
This disagrees slightly with the examples below where they state the copy is moved and dropped. Here it states the the new copy persists which is kinda the opposite. They should at least agree.
I don't know which way it's implemented or if it matters but from a explanation standpoint, letting someone copy your item so they have a new copy is more typical. It'd be more unusual if you let them copy and kept the new copy leaving them the ratty old copy you have (imagine copying homework or recipes for example).
There was a problem hiding this comment.
sorry, one more nit: this needs to be a relative, not absolute, link
steveklabnik
commented
Sep 25, 2015
@bors: r+ rollup |
bors
commented
Sep 25, 2015
📌 Commit 012f369 has been approved by |
https://users.rust-lang.org/t/confused-by-std-mem-drop/2783/3
r? @gankro