File tree 1 file changed +50
-1
lines changed
1 file changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -1611,6 +1611,56 @@ fn print_on_failure(state: &State) {
1611
1611
```
1612
1612
"## ,
1613
1613
1614
+ E0574 : r##"
1615
+ Something other than a struct, variant or union has been used when one was
1616
+ expected.
1617
+
1618
+ Erroneous code example:
1619
+
1620
+ ```compile_fail,E0574
1621
+ mod Mordor {}
1622
+
1623
+ let sauron = Mordor { x: () }; // error!
1624
+
1625
+ enum Jak {
1626
+ Daxter { i: isize },
1627
+ }
1628
+
1629
+ let eco = Jak::Daxter { i: 1 };
1630
+ match eco {
1631
+ Jak { i } => {} // error!
1632
+ }
1633
+ ```
1634
+
1635
+ In all these errors, a type was expected. For example, in the first error,
1636
+ we tried to instantiate the `Mordor` module, which is impossible. If you want
1637
+ to instantiate a type inside a module, you can do it as follow:
1638
+
1639
+ ```
1640
+ mod Mordor {
1641
+ pub struct TheRing {
1642
+ pub x: usize,
1643
+ }
1644
+ }
1645
+
1646
+ let sauron = Mordor::TheRing { x: 1 }; // ok!
1647
+ ```
1648
+
1649
+ In the second error, we tried to bind the `Jak` enum directly, which is not
1650
+ possible: you can only bind one of its variants. To do so:
1651
+
1652
+ ```
1653
+ enum Jak {
1654
+ Daxter { i: isize },
1655
+ }
1656
+
1657
+ let eco = Jak::Daxter { i: 1 };
1658
+ match eco {
1659
+ Jak::Daxter { i } => {} // ok!
1660
+ }
1661
+ ```
1662
+ "## ,
1663
+
1614
1664
E0603 : r##"
1615
1665
A private item was used outside its scope.
1616
1666
@@ -1739,7 +1789,6 @@ struct Foo<X = Box<Self>> {
1739
1789
// E0467, removed
1740
1790
// E0470, removed
1741
1791
E0573 ,
1742
- E0574 ,
1743
1792
E0575 ,
1744
1793
E0576 ,
1745
1794
E0577 ,
You can’t perform that action at this time.
0 commit comments