Provide overlapping types for coherence errors
Currently, a coherence error based on overlapping impls simply mentions the trait, and points to the two conflicting impls: ``` error: conflicting implementations for trait `Foo` ``` With this commit, the error will include all input types to the trait (including the `Self` type) after unification between the overlapping impls. In other words, the error message will provide feedback with full type details, like: ``` error: conflicting implementations of trait `Foo<u32>` for type `u8`: ``` When the `Self` type for the two impls unify to an inference variable, it is elided in the output, since "for type `_`" is just noise in that case. Closes #23980
This commit is contained in:
parent
ed121aa897
commit
bc33dd7ac4
7 changed files with 95 additions and 50 deletions
|
@ -15,7 +15,7 @@ trait MyTrait {}
|
|||
impl MyTrait for .. {}
|
||||
|
||||
impl MyTrait for .. {}
|
||||
//~^ ERROR conflicting implementations for trait `MyTrait`
|
||||
//~^ ERROR conflicting implementations of trait `MyTrait`
|
||||
|
||||
trait MySafeTrait {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue