Skip to content

Commit 10236f1

Browse files
Add long error explanation for E0577
1 parent f54911c commit 10236f1

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/librustc_resolve/error_codes.rs

+27-1
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,33 @@ match eco {
16611661
```
16621662
"##,
16631663

1664+
E0577: r##"
1665+
Something other than a module was found in visibility scope.
1666+
1667+
Erroneous code example:
1668+
1669+
```compile_fail,E0577,edition2018
1670+
pub struct Sea;
1671+
1672+
pub (in crate::Sea) struct Shark; // error!
1673+
1674+
fn main() {}
1675+
```
1676+
1677+
`Sea` is not a module, therefore, it is invalid. To fix this error, we need to
1678+
replace `Sea` with a module.
1679+
1680+
Please note that the visibility scope can only be applied on ancestors!
1681+
1682+
```edition2018
1683+
pub mod Sea {
1684+
pub (in crate::Sea) struct Shark; // ok!
1685+
}
1686+
1687+
fn main() {}
1688+
```
1689+
"##,
1690+
16641691
E0603: r##"
16651692
A private item was used outside its scope.
16661693
@@ -1791,6 +1818,5 @@ struct Foo<X = Box<Self>> {
17911818
E0573,
17921819
E0575,
17931820
E0576,
1794-
E0577,
17951821
E0578,
17961822
}

0 commit comments

Comments
 (0)