-
Notifications
You must be signed in to change notification settings - Fork 14k
Refactor DropGuard with one ManuallyDrop #147238
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
Conversation
This comment has been minimized.
This comment has been minimized.
|
I'm a bit behind on my reviews, |
b397f2e to
fff1d8d
Compare
fff1d8d to
2a1c764
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of this – the reduction of unsafe blocks is rather small, and this might lead to into_inner not optimising well since f isn't dropped in place.
| // First we ensure that dropping the guard will not trigger | ||
| // its destructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems valuable, I wouldn't remove it.
|
Okay, I'll close this. |
Tracking issue
Group the fields into a single ManuallyDrop with an inner struct. This simplifies/reduces the unsafe code.