-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
fix: Do not delay E0107 when there exists an assoc ty with the same name #151166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Collaborator
|
HIR ty lowering was modified cc @fmease |
Collaborator
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
Member
|
r? tiif |
Member
|
This looks correct to me, thanks! @bors r+ rollup |
Contributor
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jan 16, 2026
fix: Do not delay E0107 when there exists an assoc ty with the same name Fixes rust-lang#148121 When we have the following code: ```rust trait Foo<T> {} impl Foo<T: Default> for String {} ``` we delay `E0107: wrong number of generic args` to suggest moving `T: Default` bound to the impl block's param declaration. The delay is determined by whether all the missing generic parameters are mentioned by those *wrong* assoc item constraints. But this delay is wrong when there exist any *correct* assoc item constraints, i.e. when we have an assoc type whose identifier is same with a missing generic parameter like in the following code: ```rust pub trait Super<X> { type X; } pub trait A {} impl A for dyn Super<X = ()> {} ```
rust-bors bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
Rollup of 4 pull requests Successful merges: - #151155 (THIR patterns: Always use type `str` for string-constant-value nodes) - #151166 (fix: Do not delay E0107 when there exists an assoc ty with the same name) - #151172 (Use default field values in a few more cases) - #151185 (Disable `dump-ice-to-disk` on `i686-pc-windows-msvc`) r? @ghost
rust-timer
added a commit
that referenced
this pull request
Jan 16, 2026
Rollup merge of #151166 - issue-148121, r=tiif fix: Do not delay E0107 when there exists an assoc ty with the same name Fixes #148121 When we have the following code: ```rust trait Foo<T> {} impl Foo<T: Default> for String {} ``` we delay `E0107: wrong number of generic args` to suggest moving `T: Default` bound to the impl block's param declaration. The delay is determined by whether all the missing generic parameters are mentioned by those *wrong* assoc item constraints. But this delay is wrong when there exist any *correct* assoc item constraints, i.e. when we have an assoc type whose identifier is same with a missing generic parameter like in the following code: ```rust pub trait Super<X> { type X; } pub trait A {} impl A for dyn Super<X = ()> {} ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
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.
Fixes #148121
When we have the following code:
we delay
E0107: wrong number of generic argsto suggest movingT: Defaultbound to the impl block's param declaration.The delay is determined by whether all the missing generic parameters are mentioned by those wrong assoc item constraints.
But this delay is wrong when there exist any correct assoc item constraints, i.e. when we have an assoc type whose identifier is same with a missing generic parameter like in the following code: