about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-06-14 20:12:01 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2019-06-14 20:12:01 +0900
commite252aaec709cab0e460a70f616f49c6e61d7577d (patch)
treeffea548f744553c47ed40abc620f536a82b536d7
parent047f9bc94d46339032296cd872430cd71031bbbf (diff)
downloadrust-e252aaec709cab0e460a70f616f49c6e61d7577d.tar.gz
rust-e252aaec709cab0e460a70f616f49c6e61d7577d.zip
Fix examples
-rw-r--r--src/librustc_typeck/error_codes.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs
index c424388fb2e..9f8874f1ff6 100644
--- a/src/librustc_typeck/error_codes.rs
+++ b/src/librustc_typeck/error_codes.rs
@@ -3797,22 +3797,34 @@ E0592: r##"
 This error occurs when you defined methods or associated functions with same
 name.
 
-For example, in the following code:
+Erroneous code example:
 
 ```compile_fail,E0592
 struct Foo;
 
 impl Foo {
-    fn bar() {}
+    fn bar() {} // previous definition here
 }
 
 impl Foo {
-    fn bar() {}
+    fn bar() {} // duplicate definition here
 }
 ```
 
 A similar error is E0201. The difference is whether there is one declaration
 block or not. To avoid this error, you have to give them one name each.
+
+```
+struct Foo;
+
+impl Foo {
+    fn bar() {}
+}
+
+impl Foo {
+    fn baz() {} // define with different name
+}
+```
 "##,
 
 E0599: r##"