summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0416.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0416.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0416.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0416.md b/compiler/rustc_error_codes/src/error_codes/E0416.md
new file mode 100644
index 000000000..7bc316daf
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0416.md
@@ -0,0 +1,28 @@
+An identifier is bound more than once in a pattern.
+
+Erroneous code example:
+
+```compile_fail,E0416
+match (1, 2) {
+ (x, x) => {} // error: identifier `x` is bound more than once in the
+ // same pattern
+}
+```
+
+Please verify you didn't misspell identifiers' name. Example:
+
+```
+match (1, 2) {
+ (x, y) => {} // ok!
+}
+```
+
+Or maybe did you mean to unify? Consider using a guard:
+
+```
+# let (A, B, C) = (1, 2, 3);
+match (A, B, C) {
+ (x, x2, see) if x == x2 => { /* A and B are equal, do one thing */ }
+ (y, z, see) => { /* A and B unequal; do another thing */ }
+}
+```