Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long error explanation for E0577 #65434

Merged
merged 2 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/librustc_resolve/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,33 @@ trait Hello {
```
"##,

E0577: r##"
Something other than a module was found in visibility scope.

Erroneous code example:

```compile_fail,E0577,edition2018
pub struct Sea;

pub (in crate::Sea) struct Shark; // error!

fn main() {}
```

`Sea` is not a module, therefore it is invalid to use it in a visibility path.
To fix this error we need to ensure `Sea` is a module.

Please note that the visibility scope can only be applied on ancestors!

```edition2018
pub mod Sea {
pub (in crate::Sea) struct Shark; // ok!
}

fn main() {}
```
"##,

E0603: r##"
A private item was used outside its scope.

Expand Down Expand Up @@ -1990,6 +2017,5 @@ fn main() {}
// E0427, merged into 530
// E0467, removed
// E0470, removed
E0577,
E0578,
}
2 changes: 1 addition & 1 deletion src/test/ui/resolve/resolve-bad-visibility.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ LL | pub(in too_soon) struct H;

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0433, E0742.
Some errors have detailed explanations: E0433, E0577, E0742.
For more information about an error, try `rustc --explain E0433`.
1 change: 1 addition & 0 deletions src/test/ui/span/visibility-ty-params.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | m!{ m<> }

error: aborting due to 3 previous errors

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