diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-07-28 16:05:16 +0200 |
|---|---|---|
| committer | Ryan Scheel (Havvy) <ryan.havvy@gmail.com> | 2015-07-28 16:37:11 +0200 |
| commit | cf55db2ad13e5029b8c5dad1e14412df9f26ee21 (patch) | |
| tree | 0d611db75082d2243c4bfc2d814cc7ceae5bca23 | |
| parent | 4c371bb6de7a1c21b7403b86a66a8ce3318ff003 (diff) | |
| download | rust-cf55db2ad13e5029b8c5dad1e14412df9f26ee21.tar.gz rust-cf55db2ad13e5029b8c5dad1e14412df9f26ee21.zip | |
Improve E0119 error explanation
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 73ee3bbbe5b..0ac6f7ef097 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1264,7 +1264,7 @@ impl From<Foo> for i32 { // or you use a type from your crate as E0119: r##" There are conflicting trait implementations for the same type. -Erroneous code example: +Example of erroneous code: ``` trait MyTrait { @@ -1285,7 +1285,10 @@ impl MyTrait for Foo { // error: conflicting implementations for trait } ``` -When you write: +When looking for the implementation for the trait, the compiler finds +both the `impl<T> MyTrait for T` where T is all types and the `impl +MyTrait for Foo`. Since a trait cannot be implemented multiple times, +this is an error. So, when you write: ``` impl<T> MyTrait for T { |
