A private type was used in a public type signature.
Erroneous code example:
#![deny(private_in_public)] mod Foo { struct Bar(u32); pub fn bar() -> Bar { // error: private type in public interface Bar(0) } }
To solve this error, please ensure that the type is also public. The type can be made inaccessible if necessary by placing it into a private inner module, but it still has to be marked with pub
. Example:
mod Foo { pub struct Bar(u32); // we set the Bar type public pub fn bar() -> Bar { // ok! Bar(0) } }