diff options
| author | Nick Hamann <nick@wabbo.org> | 2015-05-19 00:33:39 -0500 |
|---|---|---|
| committer | Nick Hamann <nick@wabbo.org> | 2015-05-19 00:33:39 -0500 |
| commit | 35d979d8f8bb63b6063e30954c7c71ddf863b380 (patch) | |
| tree | 8b52c94336ba2806b072e6c1d0bede004e856044 | |
| parent | d50fa7eff56e6d2b4daae4cf835dc8133b235c35 (diff) | |
| download | rust-35d979d8f8bb63b6063e30954c7c71ddf863b380.tar.gz rust-35d979d8f8bb63b6063e30954c7c71ddf863b380.zip | |
Fix the error explanation for E0053.
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 6bac0299441..00cdc6eb99f 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -65,40 +65,27 @@ impl Foo for Bar { "##, E0053: r##" -For any given method of a trait, the mutabilities of the parameters must match -between the trait definition and the implementation. +The parameters of any trait method must match between a trait implementation +and the trait definition. -Here's an example where the mutability of the `self` parameter is wrong: +Here are a couple examples of this error: ``` -trait Foo { fn foo(&self); } - -struct Bar; - -impl Foo for Bar { - // error, the signature should be `fn foo(&self)` instead - fn foo(&mut self) { } +trait Foo { + fn foo(x: u16); + fn bar(&self); } -fn main() {} -``` - -Here's another example, this time for a non-`self` parameter: - -``` -trait Foo { fn foo(x: &mut bool) -> bool; } - struct Bar; impl Foo for Bar { - // error, the type of `x` should be `&mut bool` instead - fn foo(x: &bool) -> bool { *x } -} + // error, expected u16, found i16 + fn foo(x: i16) { } -fn main() {} + // error, values differ in mutability + fn foo(&mut self) { } +} ``` - - "##, E0054: r##" |
