Skip to content
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

Improve/fix description of drops #465

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct Boxy<T> {
}
```

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.

Expand Down Expand Up @@ -163,8 +163,8 @@ impl<T> Drop for SuperBox<T> {
# 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
Expand Down