Skip to content
TE105 · Type · error

Stdlib module used without `use std::…`

A bare name matches a known standard-library module (`math`, `json`, `http`, `os`, …) that was never brought into scope. Unlike TE100, the compiler recognises the name and tells you exactly which `use` line is missing.

Why this fires

A bare name matches a known standard-library module (math, json, http, os, ...), but the module was never brought into scope with use std::<name> (or use std::*). Referencing an un-imported module by name is not the same mistake as referencing a truly undefined variable (TE100) — Zolo recognizes the name and tells you exactly which use line is missing.

let result = math.sqrt(4.0)
//           ^^^^ error[TE105]: `math` requires `use std::math` (or `use std::*`)

Fix it

Add the missing import:

use std::math

let result = math.sqrt(4.0)     // ok

TE105 also fires on near-misses — a typo that is one edit away from a real module name:

let x = jsom.stringify(#{ a: 1 })
//      ^^^^ error[TE105]: `jsom` is not a known name. Did you mean the stdlib module `json` (`use std::json`)?

Fix the spelling and add the import:

use std::json

let x = json.stringify(#{ a: 1 })  // ok

See also

  • TE100 — undefined variable (a name with no relation to any stdlib module).
  • /docs/modulesuse and the standard library layout.

See also

Search Zolo

9 results

en