Skip to content

Commit 0bd4037

Browse files
authored
Rollup merge of #65434 - GuillaumeGomez:long-err-explanation-E0577, r=Dylan-DPC
Add long error explanation for E0577 Part of #61137. r? @kinnison
2 parents 6cee78c + 125d60d commit 0bd4037

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
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
}

src/test/ui/resolve/resolve-bad-visibility.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ LL | pub(in too_soon) struct H;
3030

3131
error: aborting due to 5 previous errors
3232

33-
Some errors have detailed explanations: E0433, E0742.
33+
Some errors have detailed explanations: E0433, E0577, E0742.
3434
For more information about an error, try `rustc --explain E0433`.

src/test/ui/span/visibility-ty-params.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ LL | m!{ m<> }
1818

1919
error: aborting due to 3 previous errors
2020

21+
For more information about this error, try `rustc --explain E0577`.

0 commit comments

Comments
 (0)