Emit either mono item of Drop::drop or Drop::pin_drop depending on which was implemented#156495
Emit either mono item of Drop::drop or Drop::pin_drop depending on which was implemented#156495frank-king wants to merge 1 commit into
Drop::drop or Drop::pin_drop depending on which was implemented#156495Conversation
| if let Some(trait_id) = tcx.trait_of_assoc(def_id) | ||
| && tcx.is_lang_item(trait_id, LangItem::Drop) | ||
| { | ||
| return false; |
There was a problem hiding this comment.
Like the #[rustc_force_inline] case above, I expect Drop::drop and Drop::pin_drop should never be codegened, so I tried emitting a delayed bug, but all the codegen-units tests related to drop glue failed.
I've also tried to add #[rustc_force_inline] to Drop::drop (with trait method attribute target allowed), but core could not even be built where the debug_assert_matches failed at ForceInliner::check_codegen_attributes_extra.
There was a problem hiding this comment.
Either Drop::drop or Drop::pin_drop would need to be codegened for the drop glue to call, right?
There was a problem hiding this comment.
Yes, that's true, but the root item Drop::drop or Drop::pin_drop has been collected by collect_items_root, which is not guarded by should_codegen_locally, right?
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
There was a problem hiding this comment.
The change in this file looks correct to me.
This comment has been minimized.
This comment has been minimized.
…n which was implemented
f069d6b to
043bac9
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This PR makes drop glues of types that implement
Drop::pin_dropcallDrop::pin_dropdirectly instead ofDrop::drop, and thus avoids both mono items ofDrop::dropandDrop::pin_dropbeing emitted.Part of #130494 (Pin Ergonomics).
r? @bjorn3