Skip to content

Commit b22a163

Browse files
Add long error explanation for E0577
1 parent 0b7e28a commit b22a163

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
@@ -1823,6 +1823,33 @@ trait Hello {
18231823
```
18241824
"##,
18251825

1826+
E0577: r##"
1827+
Something other than a module was found in visibility scope.
1828+
1829+
Erroneous code example:
1830+
1831+
```compile_fail,E0577,edition2018
1832+
pub struct Sea;
1833+
1834+
pub (in crate::Sea) struct Shark; // error!
1835+
1836+
fn main() {}
1837+
```
1838+
1839+
`Sea` is not a module, therefore it is invalid to use it in a visibility path.
1840+
To fix this error we need to ensure `Sea` is a module.
1841+
1842+
Please note that the visibility scope can only be applied on ancestors!
1843+
1844+
```edition2018
1845+
pub mod Sea {
1846+
pub (in crate::Sea) struct Shark; // ok!
1847+
}
1848+
1849+
fn main() {}
1850+
```
1851+
"##,
1852+
18261853
E0603: r##"
18271854
A private item was used outside its scope.
18281855
@@ -1990,6 +2017,5 @@ fn main() {}
19902017
// E0427, merged into 530
19912018
// E0467, removed
19922019
// E0470, removed
1993-
E0577,
19942020
E0578,
19952021
}

0 commit comments

Comments
 (0)