File tree 1 file changed +41
-1
lines changed
1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -1461,6 +1461,47 @@ match r {
1461
1461
```
1462
1462
"## ,
1463
1463
1464
+ E0532 : r##"
1465
+ Pattern arm did not match expected kind.
1466
+
1467
+ Erroneous code example:
1468
+
1469
+ ```compile_fail,E0532
1470
+ enum State {
1471
+ Succeeded,
1472
+ Failed(String),
1473
+ }
1474
+
1475
+ fn print_on_failure(state: &State) {
1476
+ match *state {
1477
+ // error: expected unit struct/variant or constant, found tuple
1478
+ // variant `State::Failed`
1479
+ State::Failed => println!("Failed"),
1480
+ _ => ()
1481
+ }
1482
+ }
1483
+ ```
1484
+
1485
+ To fix this error, ensure the match arm kind is the same as the expression
1486
+ matched.
1487
+
1488
+ Fixed example:
1489
+
1490
+ ```
1491
+ enum State {
1492
+ Succeeded,
1493
+ Failed(String),
1494
+ }
1495
+
1496
+ fn print_on_failure(state: &State) {
1497
+ match *state {
1498
+ State::Failed(ref msg) => println!("Failed with {}", msg),
1499
+ _ => ()
1500
+ }
1501
+ }
1502
+ ```
1503
+ "## ,
1504
+
1464
1505
}
1465
1506
1466
1507
register_diagnostics ! {
@@ -1480,6 +1521,5 @@ register_diagnostics! {
1480
1521
// E0421, merged into 531
1481
1522
// E0422, merged into 531/532
1482
1523
E0531 , // unresolved pattern path kind `name`
1483
- E0532 , // expected pattern path kind, found another pattern path kind
1484
1524
// E0427, merged into 530
1485
1525
}
You can’t perform that action at this time.
0 commit comments