]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0365.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0365.md
1 Private modules cannot be publicly re-exported. This error indicates that you
2 attempted to `pub use` a module that was not itself public.
3
4 Erroneous code example:
5
6 ```compile_fail,E0365
7 mod foo {
8     pub const X: u32 = 1;
9 }
10
11 pub use foo as foo2;
12
13 fn main() {}
14 ```
15
16 The solution to this problem is to ensure that the module that you are
17 re-exporting is itself marked with `pub`:
18
19 ```
20 pub mod foo {
21     pub const X: u32 = 1;
22 }
23
24 pub use foo as foo2;
25
26 fn main() {}
27 ```
28
29 See the [Use Declarations][use-declarations] section of the reference for
30 more information on this topic.
31
32 [use-declarations]: https://doc.rust-lang.org/reference/items/use-declarations.html