Skip to content

Commit cf55db2

Browse files
GuillaumeGomezHavvy
authored andcommitted
Improve E0119 error explanation
1 parent 4c371bb commit cf55db2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc_typeck/diagnostics.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ impl From<Foo> for i32 { // or you use a type from your crate as
12641264

12651265
E0119: r##"
12661266
There are conflicting trait implementations for the same type.
1267-
Erroneous code example:
1267+
Example of erroneous code:
12681268
12691269
```
12701270
trait MyTrait {
@@ -1285,7 +1285,10 @@ impl MyTrait for Foo { // error: conflicting implementations for trait
12851285
}
12861286
```
12871287
1288-
When you write:
1288+
When looking for the implementation for the trait, the compiler finds
1289+
both the `impl<T> MyTrait for T` where T is all types and the `impl
1290+
MyTrait for Foo`. Since a trait cannot be implemented multiple times,
1291+
this is an error. So, when you write:
12891292
12901293
```
12911294
impl<T> MyTrait for T {

0 commit comments

Comments
 (0)