Files
rust/compiler/rustc_hir_analysis/src
Matthias Krüger 0cfe78fa1f Rollup merge of #151166 - issue-148121, r=tiif
fix: Do not delay E0107 when there exists an assoc ty with the same name

Fixes rust-lang/rust#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 = ()> {}
```
2026-01-16 08:03:59 +01:00
..
2026-01-13 15:25:28 +01:00
2025-10-17 08:36:34 -05:00
2025-11-07 19:57:52 +00:00
2026-01-14 20:59:41 +08:00
2025-10-31 20:46:47 +00:00
2026-01-14 20:59:41 +08:00