rust/compiler/rustc_hir
Matthias Krüger 333c63b9fc
Rollup merge of #128377 - veera-sivarajan:fix-128249, r=davidtwco
Fix ICE Caused by Incorrectly Delaying E0107

Fixes  #128249

For the following code:
```rust
trait Foo<T> {}
impl Foo<T: Default> for u8 {}
```
#126054 added some logic to delay emitting E0107 as the names of associated type `T` in the impl header and generic parameter `T` in `trait Foo` match.

But it failed to ensure whether such unexpected associated type bounds are coming from a impl block header. This caused an ICE as the compiler was delaying E0107 for code like:
```rust
trait Trait<Type> {
    type Type;

    fn method(&self) -> impl Trait<Type: '_>;
}
```
because it assumed the associated type bound `Type: '_` is for the generic parameter `Type` in `trait Trait` since the names are same.

This PR adds a check to ensure that E0107 is delayed only in the context of impl block header.
2024-08-06 20:23:39 +02:00
..
src Rollup merge of #128377 - veera-sivarajan:fix-128249, r=davidtwco 2024-08-06 20:23:39 +02:00
Cargo.toml Remove unnecessary dependencies. 2023-11-26 08:38:42 +11:00