Skip to content

Idiomatic: Rework Option-in-Drop example to emphasize move semantics#3168

Merged
mgeisler merged 1 commit intogoogle:mainfrom
randomPoison:rework-drop-option-example
Apr 28, 2026
Merged

Idiomatic: Rework Option-in-Drop example to emphasize move semantics#3168
mgeisler merged 1 commit intogoogle:mainfrom
randomPoison:rework-drop-option-example

Conversation

@randomPoison
Copy link
Copy Markdown
Contributor

Rework the example in the "Drop: Option" slide to emphasize how Option is used to achieve move operations in Drop code. The current version of the slide emphasizes the wrong thing in my opinion, and fails to actually demonstrate the pattern of needing to perform a move operation in drop. I've modified Handle to have a fn close(self) instead of a Drop impl, that way File::drop needs to move out of its inner field in order to call close.

@randomPoison
Copy link
Copy Markdown
Contributor Author

@mgeisler can you hit the merge button if this looks good? I no longer have permissions to do so myself for some reason.

@mgeisler mgeisler merged commit d4ea311 into google:main Apr 28, 2026
37 checks passed
@mgeisler
Copy link
Copy Markdown
Collaborator

@mgeisler can you hit the merge button if this looks good? I no longer have permissions to do so myself for some reason.

Yes! Sorry about the delay — @gribozavr, can you help with permissions here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants