From ac6a9eb1dd22b5546952327f14593012870b626d Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 16:42:04 -0700 Subject: [PATCH 1/9] Added --explain for E0118. --- src/librustc_typeck/diagnostics.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index e356f612cde..9a536a5e0a1 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1533,6 +1533,26 @@ For information on the design of the orphan rules, see [RFC 1023]. [RFC 1023]: https://github.com/rust-lang/rfcs/pull/1023 "##, +EO118: r##" +Rust can't find a base type for an implementation you are providing, or the type +cannot have an implementation. For example, a typedef can't have an implementation, +since it isn't its own type (this was done in PR #6087): + +``` +type NineString = [char, ..9] +impl NineString { + // Some code here +} +``` + +In the other, simpler case, Rust just can't find the type you are providing an +impelementation for: + +``` +impl SomeTypeThatDoesntExist { } +``` +"## + E0119: r##" There are conflicting trait implementations for the same type. Example of erroneous code: From 2575687532f8d3251e55c7e4b81fdefd46c820ed Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 16:49:42 -0700 Subject: [PATCH 2/9] Added commet too --- src/librustc_typeck/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 9a536a5e0a1..c2ce16b0256 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3214,7 +3214,7 @@ register_diagnostics! { E0090, E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, - E0118, + E0118, // implementation for undefined or unsutable type // E0123, // E0127, // E0129, From 872f34934ce01897ff74c6b16b6052670deabd9d Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 16:50:58 -0700 Subject: [PATCH 3/9] E0118, not EO118! --- src/librustc_typeck/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index c2ce16b0256..694c633f116 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1533,7 +1533,7 @@ For information on the design of the orphan rules, see [RFC 1023]. [RFC 1023]: https://github.com/rust-lang/rfcs/pull/1023 "##, -EO118: r##" +E0118: r##" Rust can't find a base type for an implementation you are providing, or the type cannot have an implementation. For example, a typedef can't have an implementation, since it isn't its own type (this was done in PR #6087): From 1f4fe5f9c23cb0fa3cff998c3ff67e8b1d838f3b Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 16:55:37 -0700 Subject: [PATCH 4/9] Removed comment. Apparently that shouldnt be there. --- src/librustc_typeck/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 694c633f116..bd001ff089a 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3214,7 +3214,7 @@ register_diagnostics! { E0090, E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, - E0118, // implementation for undefined or unsutable type + E0118, // E0123, // E0127, // E0129, From a85bc05280b3e5e08d971cfa61458e8c4ee7d950 Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 16:59:06 -0700 Subject: [PATCH 5/9] De-registered the duplicate E0118 --- src/librustc_typeck/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index bd001ff089a..31e5b4d9035 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3214,7 +3214,7 @@ register_diagnostics! { E0090, E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, - E0118, +// E0118, // E0123, // E0127, // E0129, From 5fa6095f2cc17a8476fa7b0e898a99fb6e3861ef Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 17:07:37 -0700 Subject: [PATCH 6/9] I think I found the bug! I was missing a comma. --- src/librustc_typeck/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 31e5b4d9035..1e09a376445 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1551,7 +1551,7 @@ impelementation for: ``` impl SomeTypeThatDoesntExist { } ``` -"## +"##, E0119: r##" There are conflicting trait implementations for the same type. @@ -3214,7 +3214,7 @@ register_diagnostics! { E0090, E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, -// E0118, + E0118, // E0123, // E0127, // E0129, From 1eb726217d3a8ff8849594e88df068c4a13fbdc9 Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 17:14:10 -0700 Subject: [PATCH 7/9] This time, I found the error' --- src/librustc_typeck/diagnostics.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 1e09a376445..a7f1b7198e2 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3214,7 +3214,6 @@ register_diagnostics! { E0090, E0103, // @GuillaumeGomez: I was unable to get this error, try your best! E0104, - E0118, // E0123, // E0127, // E0129, From a8a8dfbe1a0aa917fb392bb8f3c037ef6a1ef27f Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Sat, 5 Sep 2015 20:23:26 -0700 Subject: [PATCH 8/9] Line longer that 80 chars. --- src/librustc_typeck/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index a7f1b7198e2..4e9bcab2e9c 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1535,8 +1535,8 @@ For information on the design of the orphan rules, see [RFC 1023]. E0118: r##" Rust can't find a base type for an implementation you are providing, or the type -cannot have an implementation. For example, a typedef can't have an implementation, -since it isn't its own type (this was done in PR #6087): +cannot have an implementation. For example, a typedef can't have an +implementation, since it isn't its own type (this was done in PR #6087): ``` type NineString = [char, ..9] From eb53461b413063ab8a73fb542a537124a8b77f54 Mon Sep 17 00:00:00 2001 From: christopherdumas Date: Wed, 9 Sep 2015 07:00:39 -0700 Subject: [PATCH 9/9] Fixed incorrect error explanation --- src/librustc_typeck/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 4e9bcab2e9c..19ca825cf35 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1535,11 +1535,11 @@ For information on the design of the orphan rules, see [RFC 1023]. E0118: r##" Rust can't find a base type for an implementation you are providing, or the type -cannot have an implementation. For example, a typedef can't have an -implementation, since it isn't its own type (this was done in PR #6087): +cannot have an implementation. For example, only a named type or a trait can +have an implementation: ``` -type NineString = [char, ..9] +type NineString = [char, ..9] // This isn't a named type (struct, enum or trait) impl NineString { // Some code here }