Skip to content

Commit 030ed01

Browse files
authored
Rollup merge of rust-lang#65434 - GuillaumeGomez:long-err-explanation-E0577, r=Dylan-DPC
Add long error explanation for E0577 Part of rust-lang#61137. r? @kinnison
2 parents 001f69d + e417180 commit 030ed01

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

src/librustc_resolve/error_codes.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct Foo<U = (), T = U> {
2626
}
2727
```
2828
29-
Please also verify that this wasn't because of a name-clash and rename the type
29+
Please also verify \hat this wasn't because of a name-clash and rename the type
3030
parameter if so.
3131
"##,
3232

@@ -1735,6 +1735,33 @@ match eco {
17351735
```
17361736
"##,
17371737

1738+
E0577: r##"
1739+
Something other than a module was found in visibility scope.
1740+
1741+
Erroneous code example:
1742+
1743+
```compile_fail,E0577,edition2018
1744+
pub struct Sea;
1745+
1746+
pub (in crate::Sea) struct Shark; // error!
1747+
1748+
fn main() {}
1749+
```
1750+
1751+
`Sea` is not a module, therefore it is invalid to use it in a visibility path.
1752+
To fix this error we need to ensure `Sea` is a module.
1753+
1754+
Please note that the visibility scope can only be applied on ancestors!
1755+
1756+
```edition2018
1757+
pub mod Sea {
1758+
pub (in crate::Sea) struct Shark; // ok!
1759+
}
1760+
1761+
fn main() {}
1762+
```
1763+
"##,
1764+
17381765
E0603: r##"
17391766
A private item was used outside its scope.
17401767
@@ -1864,6 +1891,5 @@ struct Foo<X = Box<Self>> {
18641891
// E0470, removed
18651892
E0575,
18661893
E0576,
1867-
E0577,
18681894
E0578,
18691895
}

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

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

3131
error: aborting due to 5 previous errors
3232

33-
For more information about this error, try `rustc --explain E0433`.
33+
Some errors have detailed explanations: E0433, E0577.
34+
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)