Skip to content

delegation: split resolution and lowering#157296

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-extract-resolve
Jun 4, 2026
Merged

delegation: split resolution and lowering#157296
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
aerooneqq:delegation-extract-resolve

Conversation

@aerooneqq
Copy link
Copy Markdown
Contributor

@aerooneqq aerooneqq commented Jun 2, 2026

View all comments

This PR splits delegation's AST -> HIR lowering and its resolution. Now we resolve all delegations and then lower them. This should have benefits:

Part of #118212.
r? @petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 2, 2026
@aerooneqq aerooneqq changed the title delegation: split delegation resolution and lowering delegation: split resolution and lowering Jun 2, 2026
@petrochenkov petrochenkov added the F-fn_delegation `#![feature(fn_delegation)]` label Jun 2, 2026
Comment thread compiler/rustc_ast/src/ast.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
Comment thread compiler/rustc_middle/src/hir/map.rs Outdated
@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 Jun 2, 2026
@aerooneqq
Copy link
Copy Markdown
Contributor Author

After changing Option<DefId> to Result<...> we started to emit UnresolvedDelegationCallee error during resolve, so new errors are added to tests, they were not added earlier as we had None in delegation_infos and old get_sig_id was not called at all.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aerooneqq aerooneqq force-pushed the delegation-extract-resolve branch from a2ddcb3 to 4c2c364 Compare June 3, 2026 07:59
@aerooneqq
Copy link
Copy Markdown
Contributor Author

@rustbot author

@rustbot rustbot 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 Jun 3, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 3, 2026

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

Comment thread compiler/rustc_middle/src/ty/mod.rs Outdated
Comment thread compiler/rustc_interface/src/passes.rs Outdated
Comment thread compiler/rustc_resolve/src/late.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/delegation.rs Outdated
@rust-bors

This comment has been minimized.

@aerooneqq aerooneqq force-pushed the delegation-extract-resolve branch from ba00c21 to 9259289 Compare June 4, 2026 06:07
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 4, 2026

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.

@aerooneqq aerooneqq force-pushed the delegation-extract-resolve branch from f4ee446 to 421e420 Compare June 4, 2026 06:14
@aerooneqq
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2026
Comment thread compiler/rustc_ast_lowering/src/lib.rs Outdated
@petrochenkov
Copy link
Copy Markdown
Contributor

r=me after (maybe) addressing #157296 (comment), and squashing commits.
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2026
@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 Jun 4, 2026
@aerooneqq aerooneqq force-pushed the delegation-extract-resolve branch from dbe7f3e to cf34955 Compare June 4, 2026 12:10
@aerooneqq
Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 4, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 4, 2026

📌 Commit cf34955 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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 4, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #154586 (Record failed tests with `--record`, and rerun them with `--rerun`)
 - #157296 (delegation: split resolution and lowering)
 - #156171 (Fix a coroutine UI test which is missing `#[coroutine]`)
 - #157249 (tests: codegen-llvm: Update bpf-alu32 with the new LLVM attributes)
 - #157426 (rustc-dev-guide subtree update)
@rust-bors rust-bors Bot merged commit 8ae06c8 into rust-lang:main Jun 4, 2026
12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 4, 2026
rust-timer added a commit that referenced this pull request Jun 4, 2026
Rollup merge of #157296 - aerooneqq:delegation-extract-resolve, r=petrochenkov

delegation: split resolution and lowering

This PR splits delegation's AST -> HIR lowering and its resolution. Now we resolve all delegations and then lower them. This should have benefits:

- ~For #156798, where it will be convenient to insert diagnostics about specifying target expressions for glob reuses of only static functions (the `delegations_resolutions` map will contain information whether to lower or delete target expression)~
- For #155337 and delegations to inherent methods resolution, as from what I tested up until now we should resolve them in iterative manner before AST -> HIR lowering.

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