Skip to content

delegation: support mapping of all arguments with Self type#158690

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-self-type-arguments-wrapping
Jul 8, 2026
Merged

delegation: support mapping of all arguments with Self type#158690
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-self-type-arguments-wrapping

Conversation

@aerooneqq

@aerooneqq aerooneqq commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

This PR supports applying target expression to arguments of Self type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing Box<Self>, Arc<Self>, etc.

Part of #118212.
r? @petrochenkov

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 2, 2026
@aerooneqq

Copy link
Copy Markdown
Contributor Author

Blocked on #158434.
@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 2, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov added the F-fn_delegation `#![feature(fn_delegation)]` label Jul 2, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@aerooneqq aerooneqq force-pushed the delegation-self-type-arguments-wrapping branch 4 times, most recently from aa7bea6 to 5fdf384 Compare July 6, 2026 08:30
@aerooneqq aerooneqq marked this pull request as ready for review July 6, 2026 08:31
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 6, 2026
@aerooneqq

Copy link
Copy Markdown
Contributor Author

@rustbot unblocked

@aerooneqq

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@aerooneqq aerooneqq force-pushed the delegation-self-type-arguments-wrapping branch 2 times, most recently from d9515b1 to 541ec90 Compare July 6, 2026 08:55
@petrochenkov petrochenkov removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jul 6, 2026
Comment thread compiler/rustc_ast_lowering/src/delegation/resolution.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation/resolution.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation/resolution.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation/resolution.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation/resolution.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation/mod.rs
Comment thread compiler/rustc_ast_lowering/src/lib.rs
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 6, 2026
@rust-log-analyzer

This comment has been minimized.

@aerooneqq aerooneqq force-pushed the delegation-self-type-arguments-wrapping branch from 78e635d to 30fce5c Compare July 7, 2026 09:24
@rust-log-analyzer

This comment has been minimized.

@aerooneqq

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 7, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 7, 2026
@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

✌️ @aerooneqq, you can now approve this pull request!

If @petrochenkov told you to "r=me" after making some further change, then please make that change and post @bors r=petrochenkov.

View changes since this delegation.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 7, 2026
@rustbot

rustbot commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@aerooneqq

Copy link
Copy Markdown
Contributor Author

Adjusted naming and message of an error too.

@aerooneqq

Copy link
Copy Markdown
Contributor Author

@bors squash

@rust-bors

This comment has been minimized.

* Support mapping of all arguments with Self type
* Address some review comments
* Review: use #[cfg(debug_assertions)] on the whole module
* Review: emit error when trying to map non-receiver argument when block contains definitions
* Use `cfg_select`
* Fix tidy
* Unify mapping with `should_generate_block`
* Better naming and message for error
* loop -> `extend`
@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🔨 9 commits were squashed into 831a2e8.

@rust-bors rust-bors Bot force-pushed the delegation-self-type-arguments-wrapping branch from 0398fb4 to 831a2e8 Compare July 7, 2026 11:01
@aerooneqq

Copy link
Copy Markdown
Contributor Author

@bors r=petrochenkov

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 831a2e8 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 7, 2026
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jul 7, 2026
…uments-wrapping, r=petrochenkov

delegation: support mapping of all arguments with `Self` type

This PR supports applying target expression to arguments of `Self` type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing `Box<Self>`, `Arc<Self>`, etc.

Part of rust-lang#118212.
r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
Rollup of 8 pull requests

Successful merges:

 - #156968 (diagnostics: suggest generic_const_args for const ops)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158905 (delegation: add constraints to new generic args)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
…uments-wrapping, r=petrochenkov

delegation: support mapping of all arguments with `Self` type

This PR supports applying target expression to arguments of `Self` type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing `Box<Self>`, `Arc<Self>`, etc.

Part of rust-lang#118212.
r? @petrochenkov
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
…uments-wrapping, r=petrochenkov

delegation: support mapping of all arguments with `Self` type

This PR supports applying target expression to arguments of `Self` type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing `Box<Self>`, `Arc<Self>`, etc.

Part of rust-lang#118212.
r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 7, 2026
…uments-wrapping, r=petrochenkov

delegation: support mapping of all arguments with `Self` type

This PR supports applying target expression to arguments of `Self` type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing `Box<Self>`, `Arc<Self>`, etc.

Part of rust-lang#118212.
r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #157385 (Enable Enzyme on x86_64-apple)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156016 (view-types: store view types in the AST)
 - #157385 (Enable Enzyme on x86_64-apple)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158085 (rustdoc: Fix sidebar heading order)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
 - #158922 (tests: clean up over-constraint on LLVM feature count)

Failed merges:

 - #158617 (allow mGCA const arguments to fall back to anon consts)
@rust-bors rust-bors Bot merged commit 9e8d31b into rust-lang:main Jul 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 8, 2026
rust-timer added a commit that referenced this pull request Jul 8, 2026
Rollup merge of #158690 - aerooneqq:delegation-self-type-arguments-wrapping, r=petrochenkov

delegation: support mapping of all arguments with `Self` type

This PR supports applying target expression to arguments of `Self` type.
That the first part of this feature which touches AST -> HIR lowering only and allows lowering of delegation's block several times when there are no definitions inside.
The second part will adjust typeck so we can apply adjustments to all mapped arguments as to the first argument of delegation. This should also eventually weak the condition of argument mapping allowing `Box<Self>`, `Arc<Self>`, etc.

Part of #118212.
r? @petrochenkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-fn_delegation `#![feature(fn_delegation)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants