summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0532.md
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0532.md')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0532.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0532.md b/compiler/rustc_error_codes/src/error_codes/E0532.md
new file mode 100644
index 000000000..6fb315a37
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0532.md
@@ -0,0 +1,38 @@
+Pattern arm did not match expected kind.
+
+Erroneous code example:
+
+```compile_fail,E0532
+enum State {
+ Succeeded,
+ Failed(String),
+}
+
+fn print_on_failure(state: &State) {
+ match *state {
+ // error: expected unit struct, unit variant or constant, found tuple
+ // variant `State::Failed`
+ State::Failed => println!("Failed"),
+ _ => ()
+ }
+}
+```
+
+To fix this error, ensure the match arm kind is the same as the expression
+matched.
+
+Fixed example:
+
+```
+enum State {
+ Succeeded,
+ Failed(String),
+}
+
+fn print_on_failure(state: &State) {
+ match *state {
+ State::Failed(ref msg) => println!("Failed with {}", msg),
+ _ => ()
+ }
+}
+```