-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Fix Box allocator drop elaboration #143672
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
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
r? compiler since wesleywiser is off rotation |
r? compiler |
r? compiler |
lmao I should have just taken this PR when I saw it right when it was opened |
// types with destructors still need an empty drop ladder to clear it | ||
|
||
// currently no rust types can trigger this path in a context where drop flags exist | ||
// however, a future box-like "DerefMove" trait would allow it |
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.
so... should we span_bug!
here until such a time?
New version of #131146.
Clearing Box's drop flag after running its destructor can cause it to skip dropping its allocator, so just don't. Its cleared by the drop ladder code afterwards already.
Unlike the last PR this also handles other types with destructors properly, in the event that we can have open drops on them in the future (by partial initialization or DerefMove or something).
Finally, I also added tests for the interaction with async drop here but I discovered #143658, so one of the tests has a
knownbug
annotation. Not sure if it should be in this PR at all though.Fixes #131082
r? wesleywiser - prev. reviewer