Skip to content

Added an explanation for the E0704 error. #59634

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

Merged
merged 1 commit into from
May 2, 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
30 changes: 29 additions & 1 deletion src/libsyntax/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,35 @@ and likely to change in the future.

"##,

E0704: r##"
This error indicates that a incorrect visibility restriction was specified.

Example of erroneous code:

```compile_fail,E0704
mod foo {
pub(foo) struct Bar {
x: i32
}
}
```

To make struct `Bar` only visible in module `foo` the `in` keyword should be
used:
```
mod foo {
pub(in crate::foo) struct Bar {
x: i32
}
}
# fn main() {}
```

For more information see the Rust Reference on [Visibility].

[Visibility]: https://doc.rust-lang.org/reference/visibility-and-privacy.html
"##,

E0705: r##"
A `#![feature]` attribute was declared for a feature that is stable in
the current edition, but not in all editions.
Expand Down Expand Up @@ -417,6 +446,5 @@ register_diagnostics! {
E0693, // incorrect `repr(align)` attribute format
E0694, // an unknown tool name found in scoped attributes
E0703, // invalid ABI
E0704, // incorrect visibility restriction
E0717, // rustc_promotable without stability attribute
}
1 change: 1 addition & 0 deletions src/test/ui/pub/pub-restricted.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ LL | pub (in x) non_parent_invalid: usize,

error: aborting due to 5 previous errors

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