summary refs log tree commit diff
path: root/src/librustc_error_codes
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-01-14 14:04:03 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-01-14 14:04:03 +0100
commit5076a3efc707436c20c62f90e5df47e78052ed2d (patch)
tree136ed3e8c63548587de97f74492957abcd717876 /src/librustc_error_codes
parentbf84eb538fd16743240434b3e837b36c35719fee (diff)
downloadrust-5076a3efc707436c20c62f90e5df47e78052ed2d.tar.gz
rust-5076a3efc707436c20c62f90e5df47e78052ed2d.zip
Add failing example for E0170 explanation
Diffstat (limited to 'src/librustc_error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0170.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0170.md b/src/librustc_error_codes/error_codes/E0170.md
index 4b870dbf221..56e1b5aa241 100644
--- a/src/librustc_error_codes/error_codes/E0170.md
+++ b/src/librustc_error_codes/error_codes/E0170.md
@@ -1,3 +1,24 @@
+A pattern binding is using the same name as one of the variants a type.
+
+Erroneous code example:
+
+```compile_fail,E0170
+# #![deny(warnings)]
+enum Method {
+    GET,
+    POST,
+}
+
+fn is_empty(s: Method) -> bool {
+    match s {
+        GET => true,
+        _ => false
+    }
+}
+
+fn main() {}
+```
+
 Enum variants are qualified by default. For example, given this type:
 
 ```