From c2ce7dd756c36cb619c7f231ab6596d6b180afed Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Dec 2019 13:27:17 +0100 Subject: [PATCH 1/4] Clean up E0116 error code long explanation --- src/librustc_error_codes/error_codes/E0116.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0116.md b/src/librustc_error_codes/error_codes/E0116.md index 27759a42343..ca849c2a128 100644 --- a/src/librustc_error_codes/error_codes/E0116.md +++ b/src/librustc_error_codes/error_codes/E0116.md @@ -1,11 +1,15 @@ -You can only define an inherent implementation for a type in the same crate -where the type was defined. For example, an `impl` block as below is not allowed -since `Vec` is defined in the standard library: +An inherent implementation was defined for a type outside the current crate. + +Erroneous code example: ```compile_fail,E0116 impl Vec { } // error ``` +You can only define an inherent implementation for a type in the same crate +where the type was defined. For example, an `impl` block as above is not allowed +since `Vec` is defined in the standard library. + To fix this problem, you can do either of these things: - define a trait that has the desired associated functions/types/constants and From 1e5450d4cb7bb951bbdb9bc2b09a984b132c4280 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Dec 2019 13:31:40 +0100 Subject: [PATCH 2/4] Clean up E0117 error code long explanation --- src/librustc_error_codes/error_codes/E0117.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0117.md b/src/librustc_error_codes/error_codes/E0117.md index bd362305662..7fa211d4a27 100644 --- a/src/librustc_error_codes/error_codes/E0117.md +++ b/src/librustc_error_codes/error_codes/E0117.md @@ -1,3 +1,11 @@ +The `Drop` trait was implemented on a non-struct type. + +Erroneous code example: + +```compile_fail,E0117 +impl Drop for u32 {} +``` + This error indicates a violation of one of Rust's orphan rules for trait implementations. The rule prohibits any implementation of a foreign trait (a trait defined in another crate) where @@ -6,12 +14,6 @@ trait defined in another crate) where - all of the parameters being passed to the trait (if there are any) are also foreign. -Here's one example of this error: - -```compile_fail,E0117 -impl Drop for u32 {} -``` - To avoid this kind of error, ensure that at least one local type is referenced by the `impl`: From 9eaea4d3ea1ae6d6858af1a83a7d44c759a31212 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Dec 2019 13:35:26 +0100 Subject: [PATCH 3/4] Clean up E0118 error code long explanation --- src/librustc_error_codes/error_codes/E0118.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0118.md b/src/librustc_error_codes/error_codes/E0118.md index baf35ffbb0b..5cb5f506e0a 100644 --- a/src/librustc_error_codes/error_codes/E0118.md +++ b/src/librustc_error_codes/error_codes/E0118.md @@ -1,5 +1,7 @@ -You're trying to write an inherent implementation for something which isn't a -struct nor an enum. Erroneous code example: +An inherent implementation was defined for something which isn't a struct nor +an enum. + +Erroneous code example: ```compile_fail,E0118 impl (u8, u8) { // error: no base type found for inherent implementation From ae753a55ac8b16772ad7617c8512433921271abc Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Dec 2019 13:36:50 +0100 Subject: [PATCH 4/4] some error codes long explanation --- src/librustc_error_codes/error_codes/E0109.md | 1 + src/librustc_error_codes/error_codes/E0119.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_error_codes/error_codes/E0109.md b/src/librustc_error_codes/error_codes/E0109.md index 5bc229ade52..2eab9725a6f 100644 --- a/src/librustc_error_codes/error_codes/E0109.md +++ b/src/librustc_error_codes/error_codes/E0109.md @@ -1,4 +1,5 @@ You tried to provide a generic argument to a type which doesn't need it. + Erroneous code example: ```compile_fail,E0109 diff --git a/src/librustc_error_codes/error_codes/E0119.md b/src/librustc_error_codes/error_codes/E0119.md index 0af3bd4a0de..e596349e5e2 100644 --- a/src/librustc_error_codes/error_codes/E0119.md +++ b/src/librustc_error_codes/error_codes/E0119.md @@ -1,5 +1,6 @@ There are conflicting trait implementations for the same type. -Example of erroneous code: + +Erroneous code example: ```compile_fail,E0119 trait MyTrait {