Uh oh!
There was an error while loading. Please reload this page.
note that calling drop() explicitly is a compiler error - #35710
Conversation
rust-highfive
commented
Aug 16, 2016
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
matthew-piziak
commented
Aug 16, 2016
There was a problem hiding this comment.
Should mention that there’s a drop<T>(t: T) function in prelude which will call it for you.
There was a problem hiding this comment.
Added a mention. Out of curiosity, do you know why calling the destructor is discouraged when it's easy enough to call std::mem::drop (which would be easy enough to write even if it didn't exist)?
There was a problem hiding this comment.
Because the destructor does not take ownership. There’s a ton of book-keeping minutiæ going behind the covers other than just calling the destructor when a type is dropped too. Simply calling the Drop::drop wouldn’t really drop the type, only run the destructor.
GuillaumeGomez
commented
Aug 17, 2016
Please squash your commits. |
136cfb3 to
da2bfffCompareThere was a problem hiding this comment.
this should just be std::mem::drop, and with the graves
da2bfff to
26a11d8ComparePart of rust-lang#29365 explain that std::mem::drop in prelude will invoke Drop change "prelude" -> "the prelude"; change links to reference-style move link references to links' section
0d659c1 to
a516dbbComparesteveklabnik
commented
Aug 18, 2016
@bors: r+ rollup |
bors
commented
Aug 18, 2016
📌 Commit a516dbb has been approved by |
…veklabnik note that calling drop() explicitly is a compiler error Part of rust-lang#29365
…veklabnik note that calling drop() explicitly is a compiler error Part of rust-lang#29365
…veklabnik note that calling drop() explicitly is a compiler error Part of rust-lang#29365
…veklabnik note that calling drop() explicitly is a compiler error Part of rust-lang#29365
Part of #29365