]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | Private items cannot be publicly re-exported. This error indicates that you |
2 | attempted to `pub use` a type or value that was not itself public. | |
3 | ||
4 | Erroneous code example: | |
5 | ||
f9f354fc XL |
6 | ```compile_fail,E0364 |
7 | mod a { | |
8 | fn foo() {} | |
60c5eb7d | 9 | |
f9f354fc XL |
10 | mod a { |
11 | pub use super::foo; // error! | |
12 | } | |
13 | } | |
60c5eb7d XL |
14 | ``` |
15 | ||
16 | The solution to this problem is to ensure that the items that you are | |
17 | re-exporting are themselves marked with `pub`: | |
18 | ||
19 | ``` | |
f9f354fc XL |
20 | mod a { |
21 | pub fn foo() {} // ok! | |
60c5eb7d | 22 | |
f9f354fc XL |
23 | mod a { |
24 | pub use super::foo; | |
25 | } | |
26 | } | |
60c5eb7d XL |
27 | ``` |
28 | ||
74b04a01 XL |
29 | See the [Use Declarations][use-declarations] section of the reference for |
30 | more information on this topic. | |
60c5eb7d | 31 | |
74b04a01 | 32 | [use-declarations]: https://doc.rust-lang.org/reference/items/use-declarations.html |