]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0446.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0446.md
1 A private type was used in a public type signature.
2
3 Erroneous code example:
4
5 ```compile_fail,E0446
6 #![deny(private_in_public)]
7
8 mod Foo {
9     struct Bar(u32);
10
11     pub fn bar() -> Bar { // error: private type in public interface
12         Bar(0)
13     }
14 }
15 ```
16
17 To solve this error, please ensure that the type is also public. The type
18 can be made inaccessible if necessary by placing it into a private inner
19 module, but it still has to be marked with `pub`.
20 Example:
21
22 ```
23 mod Foo {
24     pub struct Bar(u32); // we set the Bar type public
25
26     pub fn bar() -> Bar { // ok!
27         Bar(0)
28     }
29 }
30 ```