From f2ea02892a5f9413040d2f24edb096940f2b0d4e Mon Sep 17 00:00:00 2001 From: Gurinder Singh Date: Sat, 5 Oct 2024 13:04:29 +0530 Subject: [PATCH] Improve/fix description of drops --- src/destructors.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/destructors.md b/src/destructors.md index e70c5e1..975babe 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -102,7 +102,7 @@ struct Boxy { } ``` -will have its data1 and data2's fields destructors whenever it "would" be +will have the destructors of its `data1` and `data2` fields called whenever it "would" be dropped, even though it itself doesn't implement Drop. We say that such a type *needs Drop*, even though it is not itself Drop. @@ -163,8 +163,8 @@ impl Drop for SuperBox { # fn main() {} ``` -However this has fairly odd semantics: you're saying that a field that *should* -always be Some *may* be None, just because that happens in the destructor. Of +However this has fairly odd semantics: you are saying that a field that *should* +always be Some *may* be None, just because of what happens in the destructor. Of course this conversely makes a lot of sense: you can call arbitrary methods on self during the destructor, and this should prevent you from ever doing so after deinitializing the field. Not that it will prevent you from producing any other