Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

@ShoyuVanilla ShoyuVanilla commented Jan 15, 2026

Fixes #148121

When we have the following code:

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:

pub trait Super<X> {
    type X;
}
pub trait A {}
impl A for dyn Super<X = ()> {}

@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

HIR ty lowering was modified

cc @fmease

@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 Jan 15, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: trait takes 1 generic argument but 0 generic arguments were supplied

3 participants