about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-15 13:20:17 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-11-15 13:24:47 +0100
commit1a3c8c8964ec44c81fee69fbe25cbd8910909284 (patch)
tree40b339993d32f260f7516145c04f0e37e4ddbd95 /src/librustc_error_codes/error_codes
parent2312207d9187efa1f3923f1b454c0f9ba730f46d (diff)
downloadrust-1a3c8c8964ec44c81fee69fbe25cbd8910909284.tar.gz
rust-1a3c8c8964ec44c81fee69fbe25cbd8910909284.zip
Clean up E0050
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0050.md26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/librustc_error_codes/error_codes/E0050.md b/src/librustc_error_codes/error_codes/E0050.md
index 79d070802d3..7b84c480073 100644
--- a/src/librustc_error_codes/error_codes/E0050.md
+++ b/src/librustc_error_codes/error_codes/E0050.md
@@ -1,9 +1,7 @@
-This error indicates that an attempted implementation of a trait method
-has the wrong number of function parameters.
+An attempted implementation of a trait method has the wrong number of function
+parameters.
 
-For example, the trait below has a method `foo` with two function parameters
-(`&self` and `u8`), but the implementation of `foo` for the type `Bar` omits
-the `u8` parameter:
+Erroneous code example:
 
 ```compile_fail,E0050
 trait Foo {
@@ -18,3 +16,21 @@ impl Foo for Bar {
     fn foo(&self) -> bool { true }
 }
 ```
+
+For example, the `Foo` trait has a method `foo` with two function parameters
+(`&self` and `u8`), but the implementation of `foo` for the type `Bar` omits
+the `u8` parameter. To fix this error, they must have the same parameters:
+
+```
+trait Foo {
+    fn foo(&self, x: u8) -> bool;
+}
+
+struct Bar;
+
+impl Foo for Bar {
+    fn foo(&self, x: u8) -> bool { // ok!
+        true
+    }
+}
+```