Error codes

E0120: private item

In a terminal: auk explain E0120 prints this page.

On this page

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#

toml
[package]
name = "app"
version = "0.1.0"
auk
fn secret(): int = 2
auk
fn main() { print(geo.secret()) }

Fixed#

auk
pub fn secret(): int = 2

Common causes#

  • Forgetting pub on a function meant to be used elsewhere.
  • Calling another module's internal helper: use its public API instead.
  • A pub fn whose signature mentions a private type.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page