File tree 1 file changed +45
-1
lines changed
1 file changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -1525,6 +1525,51 @@ match r {
1525
1525
```
1526
1526
"## ,
1527
1527
1528
+ E0531 : r##"
1529
+ An unknown tuple struct/variant has been used.
1530
+
1531
+ Erroneous code example:
1532
+
1533
+ ```compile_fail,E0531
1534
+ let Type(x) = Type(12); // error!
1535
+ match Bar(12) {
1536
+ Bar(x) => {} // error!
1537
+ _ => {}
1538
+ }
1539
+ ```
1540
+
1541
+ In most cases, it's either a forgotten import or a typo. However, let's look at
1542
+ how you can have such a type:
1543
+
1544
+ ```edition2018
1545
+ struct Type(u32); // this is a tuple struct
1546
+
1547
+ enum Foo {
1548
+ Bar(u32), // this is a tuple variant
1549
+ }
1550
+
1551
+ use Foo::*; // To use Foo's variant directly, we need to import them in
1552
+ // the scope.
1553
+ ```
1554
+
1555
+ Either way, it should work fine with our previous code:
1556
+
1557
+ ```edition2018
1558
+ struct Type(u32);
1559
+
1560
+ enum Foo {
1561
+ Bar(u32),
1562
+ }
1563
+ use Foo::*;
1564
+
1565
+ let Type(x) = Type(12); // ok!
1566
+ match Type(12) {
1567
+ Type(x) => {} // ok!
1568
+ _ => {}
1569
+ }
1570
+ ```
1571
+ "## ,
1572
+
1528
1573
E0532 : r##"
1529
1574
Pattern arm did not match expected kind.
1530
1575
@@ -1675,7 +1720,6 @@ fn const_id<T, const N: T>() -> T { // error: const parameter
1675
1720
// E0419, merged into 531
1676
1721
// E0420, merged into 532
1677
1722
// E0421, merged into 531
1678
- E0531 , // unresolved pattern path kind `name`
1679
1723
// E0427, merged into 530
1680
1724
// E0467, removed
1681
1725
// E0470, removed
You can’t perform that action at this time.
0 commit comments