File tree Expand file tree Collapse file tree 1 file changed +50
-1
lines changed Expand file tree Collapse file tree 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) {
16111611```
16121612"## ,
16131613
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+
16141664E0603 : r##"
16151665A private item was used outside its scope.
16161666
@@ -1739,7 +1789,6 @@ struct Foo<X = Box<Self>> {
17391789// E0467, removed
17401790// E0470, removed
17411791 E0573 ,
1742- E0574 ,
17431792 E0575 ,
17441793 E0576 ,
17451794 E0577 ,
You can’t perform that action at this time.
0 commit comments