333c63b9fc
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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl | ||
README.md |
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.