Implement pinned drop sugar#156452
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
9c61b5e to
9913270
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 comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
|
My general goal now is to simplify things and prune unnecessary stuff. |
|
Reminder, once the PR becomes ready for a review, use |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Addressed the latest review feedback. Changes:
@rustbot ready |
|
Thanks for the review, I addressed your concerns @rustbot ready |
51db9cb to
282ec28
Compare
|
@bors r+ |
…ream, 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 rust-lang#144537 rust-lang#130494
This comment has been minimized.
This comment has been minimized.
…rochenkov 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 #144537 #130494
|
💔 Test for 5af63f6 failed: CI. Failed job:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
CI seems to have failed due to transient infra rather than this PR: 'The hosted runner lost communication with the server. Anything in your workflow that terminates the runner process, starves it for CPU/Memory, or blocks its network access can cause this error.' Can we please retry the failed CI run? |
|
@bors retry |
…ream, 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 rust-lang#144537 rust-lang#130494
…uwer Rollup of 8 pull requests Successful merges: - #156493 (actually run the temp_dir doctest) - #156452 (Implement pinned drop sugar) - #156600 (Make const param default test reproduce original ICE) - #156556 (Require UTF-8 in `Utf8Pattern::StringPattern`) - #156565 (delegation: emit error when self type is not specified and accessed) - #156577 (Test EII UI tests with prefer-dynamic) - #156586 (Use DropCtxt::new_block and new_block_with_statements systematically.) - #156587 (Correctly handle associated items in rustdoc macro expansion)
…ream, 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 rust-lang#144537 rust-lang#130494
Rollup of 11 pull requests Successful merges: - #148788 (Unconstrained parameter fix) - #153238 (debuginfo: slices are DW_TAG_array_type's) - #155521 (Add lint againts invalid runtime symbol definitions) - #156319 (Require EIIs to be defined when we compile a rust dylib) - #156452 (Implement pinned drop sugar) - #156600 (Make const param default test reproduce original ICE) - #156493 (actually run the temp_dir doctest) - #156556 (Require UTF-8 in `Utf8Pattern::StringPattern`) - #156565 (delegation: emit error when self type is not specified and accessed) - #156586 (Use DropCtxt::new_block and new_block_with_statements systematically.) - #156587 (Correctly handle associated items in rustdoc macro expansion)
View all comments
Implements
fn drop(&pin mut self)as sugar forDrop::pin_drop.The resolver recognizes
fn drop(&pin mut self)syntactically in trait impls and performs lookup using the effectivepin_dropname. AST lowering independently rechecks the syntactic sugar, validates that the resolved item belongs to the actualDroplang trait, and emits HIR with identpin_dropfor 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 effectivepin_droplookup. The resolver does not need to know whether the trait is the actualDroplang 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 usepin_drop, while non-#[pin_v2]types may still implementpin_drop.r? @petrochenkov
Related
#144537
#130494