Items are private to their module unless marked pub. Another module of the program referred
to a function, constant or type that isn't public. Privacy keeps a module's helpers free to
change without breaking callers.
Wrong#
[package]
name = "app"
version = "0.1.0"fn secret(): int = 2fn main() { print(geo.secret()) }Fixed#
pub fn secret(): int = 2Common causes#
- Forgetting
pubon a function meant to be used elsewhere. - Calling another module's internal helper: use its public API instead.
- A
pub fnwhose signature mentions a private type.