]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0704.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0704.md
1 An incorrect visibility restriction was specified.
2
3 Erroneous code example:
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 ```
17 mod foo {
18     pub(in crate::foo) struct Bar {
19         x: i32
20     }
21 }
22 # fn main() {}
23 ```
24
25 For more information see the Rust Reference on [Visibility].
26
27 [Visibility]: https://doc.rust-lang.org/reference/visibility-and-privacy.html