]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0704.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0704.md
1 This error indicates that a incorrect visibility restriction was specified.
2
3 Example of erroneous code:
4
5 ```compile_fail,E0704
6 mod foo {
7     pub(foo) struct Bar {
8         x: i32
9     }
10 }
11 ```
12
13 To make struct `Bar` only visible in module `foo` the `in` keyword should be
14 used:
15 ```
16 mod foo {
17     pub(in crate::foo) struct Bar {
18         x: i32
19     }
20 }
21 # fn main() {}
22 ```
23
24 For more information see the Rust Reference on [Visibility].
25
26 [Visibility]: https://doc.rust-lang.org/reference/visibility-and-privacy.html