-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Explain drop a bit more #30696
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
Explain drop a bit more #30696
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -95,6 +95,16 @@ use fmt; | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
pub trait Drop { | |||
/// A method called when the value goes out of scope. | |||
/// | |||
/// When this method has been called, `self` has not yet been deallocated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the tense in the first clause makes things a bit ambiguous. How about something like "Before this method is called, self
has not yet been deallocated."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not sure it even makes sense to use the word "deallocated," since a number of Drop
impls don't have anything to do with allocation. I think this description should probably just talk about it being invalid (or some other word) to access self
after drop
has been called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I mean, I felt like it was a little weird because &mut
is always valid, but @durka felt differently.
I saw this patch as a quick improvement, not the final, super-awesome docs. I have some stuff that's a bit higher priority than this right now. @brson do you think it's better to
|
It's an improvement on what's there so r=me |
@bors: r=brson rollup Okay! I will bump this up on my priority list a bit as well. |
📌 Commit 3385fba has been approved by |
💔 Test failed - auto-win-gnu-64-nopt-t |
@bors: retry |
⚡ Previous build results for auto-linux-64-debug-opt, auto-linux-64-nopt-t, auto-linux-64-opt, auto-linux-cross-opt, auto-linux-musl-64-opt, auto-mac-32-opt, auto-mac-64-nopt-t, auto-mac-64-opt, auto-win-msvc-32-opt are reusable. Rebuilding only auto-linux-32-nopt-t, auto-linux-32-opt, auto-linux-64-x-android-t, auto-win-gnu-32-nopt-t, auto-win-gnu-32-opt, auto-win-gnu-64-nopt-t, auto-win-gnu-64-opt, auto-win-msvc-64-opt... |
Fixes #30655