rust/compiler/rustc_hir_analysis
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
..
src Rollup merge of #151166 - issue-148121, r=tiif 2026-01-16 08:03:59 +01:00
Cargo.toml Move attribute lints to rustc_lint 2025-12-05 14:22:52 +01:00
messages.ftl ensure generics are still properly reported on EII *implementations*, and test this 2026-01-13 11:59:59 +01:00
README.md Update links in compiler/rustc_hir_analysis/README.md for type checking 2025-12-26 16:34:49 +09:00

For high-level intro to how type checking works in rustc, see the hir typeck chapter of the rustc dev guide.