Skip to content

fix: Only run Drop::drop when implemented#22582

Open
Veykril wants to merge 1 commit into
rust-lang:masterfrom
Veykril:lukaswirth/push-myksxrlknmnl
Open

fix: Only run Drop::drop when implemented#22582
Veykril wants to merge 1 commit into
rust-lang:masterfrom
Veykril:lukaswirth/push-myksxrlknmnl

Conversation

@Veykril

@Veykril Veykril commented Jun 13, 2026

Copy link
Copy Markdown
Member

Otherwise with the recent Drop changes we now get stuck in a recursion as we attempt to drop Pin<&mut Self>which itself then runs a destructor forPin<&mut Pin<&mut Self>>` and so on.

Was authored with opus 4.8 for investigation.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 13, 2026
Comment on lines +3049 to +3060
let (drop_impl, drop_args) = self.db.lookup_impl_method(
ParamEnvAndCrate { param_env: self.param_env.param_env, krate: self.crate_id },
drop_fn,
generic_args,
);
if let Either::Left(drop_impl) = drop_impl
&& matches!(drop_impl.lookup(self.db).container, ItemContainerId::ImplId(_))
&& let Ok(body) = self.db.monomorphized_mir_body(
drop_impl.into(),
drop_args.store(),
self.param_env.store(),
)

@Veykril Veykril Jun 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically here we now only run drop when its a concrete impl, not sure if we have a better more concise way of checking this tbh

View changes since the review

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants