about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-08-31 20:10:57 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-08-31 20:10:57 +0200
commitf3ae96ecd54b244857ce565c373a3363009e68f3 (patch)
treec26a79d90474d62137fcbb45da978914c32ceb4d
parent6c44bcc4ffeb0ee8059c2c167388c69dedf1ea44 (diff)
downloadrust-f3ae96ecd54b244857ce565c373a3363009e68f3.tar.gz
rust-f3ae96ecd54b244857ce565c373a3363009e68f3.zip
Clean up E0769 explanation
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0769.md22
1 files changed, 15 insertions, 7 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0769.md b/compiler/rustc_error_codes/src/error_codes/E0769.md
index d1995be9899..4a3b674b058 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0769.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0769.md
@@ -1,5 +1,5 @@
-A tuple struct or tuple variant was used in a pattern as if it were a
-struct or struct variant.
+A tuple struct or tuple variant was used in a pattern as if it were a struct or
+struct variant.
 
 Erroneous code example:
 
@@ -7,9 +7,13 @@ Erroneous code example:
 enum E {
     A(i32),
 }
+
 let e = E::A(42);
+
 match e {
-    E::A { number } => println!("{}", x),
+    E::A { number } => { // error!
+        println!("{}", number);
+    }
 }
 ```
 
@@ -21,12 +25,14 @@ To fix this error, you can use the tuple pattern:
 # }
 # let e = E::A(42);
 match e {
-    E::A(number) => println!("{}", number),
+    E::A(number) => { // ok!
+        println!("{}", number);
+    }
 }
 ```
 
-Alternatively, you can also use the struct pattern by using the correct
-field names and binding them to new identifiers:
+Alternatively, you can also use the struct pattern by using the correct field
+names and binding them to new identifiers:
 
 ```
 # enum E {
@@ -34,6 +40,8 @@ field names and binding them to new identifiers:
 # }
 # let e = E::A(42);
 match e {
-    E::A { 0: number } => println!("{}", number),
+    E::A { 0: number } => { // ok!
+        println!("{}", number);
+    }
 }
 ```