delegation: support proper interaction of user-specified args and impl Traits#155096
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Apr 13, 2026
Conversation
Collaborator
|
HIR ty lowering was modified cc @fmease |
Contributor
|
r=me after squashing commits. |
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
Contributor
|
@bors delegate+ |
Contributor
|
✌️ @aerooneqq, you can now approve this pull request! If @petrochenkov told you to " |
21818db to
51888a1
Compare
Contributor
Author
|
@bors r=petrochenkov |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Apr 13, 2026
…d-args-impl-traits, r=petrochenkov
delegation: support proper interaction of user-specified args and impl Traits
This PR supports usages of user-specified args with impl Traits. When there are user-specified args in child we still need to generate synthetic generic params and use them during signature inheritance:
```rust
fn foo<T, const N: usize>(f: impl FnOnce()) {}
reuse foo::<String, 123> as bar;
//desugaring
fn bar<TSynth: impl FnOnce()>(f: _) {
foo::<String, 123>(f)
}
```
When inheriting predicates we process impl Trait ones, so we need generic params to instantiate them. Other approach may involve not generating synthetic generic params and try to filter out those predicates, but fairly generating synthetic params seems more consistent?.
Fixes rust-lang#154780, part of rust-lang#118212.
r? @petrochenkov
This was referenced Apr 13, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Apr 13, 2026
…uwer Rollup of 10 pull requests Successful merges: - #155227 (`rust-analyzer` subtree update) - #153335 (Add #![unstable_removed(..)] attribute to track removed features) - #154932 (Handle RTN projections in assoc type restriction diagnostics) - #155096 (delegation: support proper interaction of user-specified args and impl Traits) - #155106 (cg_llvm: scalable vectors with `simd_cast` and `simd_select`) - #155140 (add regression test for OpenOptionsExt downstream compat) - #155182 (Make the expansion of guard metavars begin guard non-terminals) - #155226 (delegation: revert execution of hir_crate_items before delayed lowering) - #153997 (Use closures more consistently in `dep_graph.rs`.) - #155003 (update thin-vec)
rust-timer
added a commit
that referenced
this pull request
Apr 13, 2026
Rollup merge of #155096 - aerooneqq:delegation-user-specified-args-impl-traits, r=petrochenkov delegation: support proper interaction of user-specified args and impl Traits This PR supports usages of user-specified args with impl Traits. When there are user-specified args in child we still need to generate synthetic generic params and use them during signature inheritance: ```rust fn foo<T, const N: usize>(f: impl FnOnce()) {} reuse foo::<String, 123> as bar; //desugaring fn bar<TSynth: impl FnOnce()>(f: _) { foo::<String, 123>(f) } ``` When inheriting predicates we process impl Trait ones, so we need generic params to instantiate them. Other approach may involve not generating synthetic generic params and try to filter out those predicates, but fairly generating synthetic params seems more consistent?. Fixes #154780, part of #118212. r? @petrochenkov
github-actions Bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Apr 13, 2026
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#155227 (`rust-analyzer` subtree update) - rust-lang/rust#153335 (Add #![unstable_removed(..)] attribute to track removed features) - rust-lang/rust#154932 (Handle RTN projections in assoc type restriction diagnostics) - rust-lang/rust#155096 (delegation: support proper interaction of user-specified args and impl Traits) - rust-lang/rust#155106 (cg_llvm: scalable vectors with `simd_cast` and `simd_select`) - rust-lang/rust#155140 (add regression test for OpenOptionsExt downstream compat) - rust-lang/rust#155182 (Make the expansion of guard metavars begin guard non-terminals) - rust-lang/rust#155226 (delegation: revert execution of hir_crate_items before delayed lowering) - rust-lang/rust#153997 (Use closures more consistently in `dep_graph.rs`.) - rust-lang/rust#155003 (update thin-vec)
github-actions Bot
pushed a commit
to rust-lang/rust-analyzer
that referenced
this pull request
Apr 16, 2026
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#155227 (`rust-analyzer` subtree update) - rust-lang/rust#153335 (Add #![unstable_removed(..)] attribute to track removed features) - rust-lang/rust#154932 (Handle RTN projections in assoc type restriction diagnostics) - rust-lang/rust#155096 (delegation: support proper interaction of user-specified args and impl Traits) - rust-lang/rust#155106 (cg_llvm: scalable vectors with `simd_cast` and `simd_select`) - rust-lang/rust#155140 (add regression test for OpenOptionsExt downstream compat) - rust-lang/rust#155182 (Make the expansion of guard metavars begin guard non-terminals) - rust-lang/rust#155226 (delegation: revert execution of hir_crate_items before delayed lowering) - rust-lang/rust#153997 (Use closures more consistently in `dep_graph.rs`.) - rust-lang/rust#155003 (update thin-vec)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR supports usages of user-specified args with impl Traits. When there are user-specified args in child we still need to generate synthetic generic params and use them during signature inheritance:
When inheriting predicates we process impl Trait ones, so we need generic params to instantiate them. Other approach may involve not generating synthetic generic params and try to filter out those predicates, but fairly generating synthetic params seems more consistent?.
Fixes #154780, part of #118212.
r? @petrochenkov