-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Add Drop::pin_drop for pinned drops
#144537
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
base: master
Are you sure you want to change the base?
Conversation
362f769 to
1497185
Compare
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #146071) made this pull request unmergeable. Please resolve the merge conflicts. |
1497185 to
9b7201c
Compare
Drop::pin_drop for !Unpin typesDrop::pin_drop for pinned drops
This comment has been minimized.
This comment has been minimized.
d6ddfcf to
7b4bb5c
Compare
This comment has been minimized.
This comment has been minimized.
7b4bb5c to
36ca628
Compare
This comment has been minimized.
This comment has been minimized.
36ca628 to
252d6fc
Compare
This comment has been minimized.
This comment has been minimized.
|
The CI failed because |
Fixes rust-lang#122630 (accidentally).
252d6fc to
02b0b0d
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
☔ The latest upstream changes (presumably #146938) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR is part of the
pin_ergonomicsexperiment (the tracking issue is #130494). It allows implementingDropwith a pinnedselfreceiver, which is required for safe pin-projection.Implementations:
dropandpin_dropshould be implemented.droporpin_drop. They should only be called by the drop glue.pin_dropmust and must only be used with types that support pin-projection. It will be implemented after the pin-projection checks are ready (i.e. checking which types can be projected toPin<&mut FieldType>fromPin<&mut Self>).fn drop(&pin mut self)and desugars tofn pin_drop(&pin mut self).Fixes #122630 (by accident).
Alternatives
Add a
PinDroptrait that has thepin_dropmethod.It is semantically clearer, but would duplicate all special checks of
Drop.It can be refactored if the trait hierarchy feature is ready.