Files
rust/compiler/rustc_resolve
Jonathan Brouwer 4903ba3b6b Rollup merge of #156452 - P8L1:implement-pin-drop-sugar-upstream, r=petrochenkov
Implement pinned drop sugar

Implements `fn drop(&pin mut self)` as sugar for `Drop::pin_drop`.

The resolver recognizes `fn drop(&pin mut self)` syntactically in trait impls and performs lookup using the effective `pin_drop` name. AST lowering independently rechecks the syntactic sugar, validates that the resolved item belongs to the actual `Drop` lang trait, and emits HIR with ident `pin_drop` for accepted sugar. Existing type checking, Drop validation, drop glue, and direct-call checks remain unchanged.

Drop identity is checked during AST lowering through `tcx.lang_items().drop_trait()`, after resolver has performed the effective `pin_drop` lookup. The resolver does not need to know whether the trait is the actual `Drop` lang item, and it no longer passes marked impl item IDs to lowering.

This intentionally preserves the base pinned-drop behavior where `#[pin_v2]` types must use `pin_drop`, while non-`#[pin_v2]` types may still implement `pin_drop`.

r? @petrochenkov

## Related

https://github.com/rust-lang/rust/pull/144537
https://github.com/rust-lang/rust/issues/130494
2026-05-15 18:16:32 +02:00
..
2026-04-08 21:09:07 +02:00