Conversation
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
|
(Does this work?) |
| /// The `Drop` trait is used to run some code when a value goes out of scope. | ||
| /// This is sometimes called a 'destructor'. | ||
| /// | ||
| /// When a value goes out of scope, if it implements this trait, it will have |
There was a problem hiding this comment.
This is a bit repetitive w.r.t "when a value goes out of scope".
There was a problem hiding this comment.
That's fine, as the first line is a summary, and this is the full explanation.
src/libcore/ops.rs
Outdated
| /// | ||
| /// Because of the recursive dropping, even for types that do not implement | ||
| /// this trait, you do not need to implement this trait unless your type | ||
| /// needs its own destructor logic. |
There was a problem hiding this comment.
"even for types that do not implement this trait, you do not need to implement this trait"
doesn't parse to me :)
There was a problem hiding this comment.
This is what happens when you stare at the screen for half an hour wondering what to write.
| /// } | ||
| /// ``` | ||
| /// | ||
| /// Showing the recursive nature of `Drop`. When `outer` goes out of scope, the |
There was a problem hiding this comment.
First sentence is incomplete?
There was a problem hiding this comment.
Only as much as the first sentence to the previous example which says "A trivial implementation of Drop".
There was a problem hiding this comment.
Yeah; I think this is fine, though personally, I tend to use fragments like this for the short ones, and since there's more here, I'd probably make it a full sentence. NBD
src/libcore/ops.rs
Outdated
| /// | ||
| /// Showing the recursive nature of `Drop`. When `outer` goes out of scope, the | ||
| /// `drop` method will be called for `Outer` and then the `drop` method for | ||
| /// `Inner` will be called. Therefore `main` prints `Dropping Outer!` and then |
There was a problem hiding this comment.
repetitive wording "the drop method will be called for Outer and then the drop method for Inner will be called."
Why not "the drop method will be called first for Outer, then for Inner"
| /// } | ||
| /// ``` | ||
| /// | ||
| /// Because variables are dropped in the reverse order they are declared, |
There was a problem hiding this comment.
Is "declared" the right term here?
| /// The `Drop` trait is used to run some code when a value goes out of scope. | ||
| /// This is sometimes called a 'destructor'. | ||
| /// | ||
| /// When a value goes out of scope, if it implements this trait, it will have |
There was a problem hiding this comment.
That's fine, as the first line is a summary, and this is the full explanation.
| /// } | ||
| /// ``` | ||
| /// | ||
| /// Showing the recursive nature of `Drop`. When `outer` goes out of scope, the |
There was a problem hiding this comment.
Yeah; I think this is fine, though personally, I tend to use fragments like this for the short ones, and since there's more here, I'd probably make it a full sentence. NBD
| /// } | ||
| /// ``` | ||
| /// | ||
| /// Because variables are dropped in the reverse order they are declared, |
|
@bors: r+ rollup thanks so much! |
|
📌 Commit b41b294 has been approved by |
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Document drop more. Adds two examples to Drop and describes the recursive drop on types that contain fields.
Adds two examples to Drop and describes the recursive drop on types that contain fields.