Home / Docs / Diagnostics

U1009: Reserved module name

Release v0.4.0

Module paths whose first segment is std or prelude belong to the standard library (spec/10 §11 rule 8): the prelude and the standard modules: std.host and std.testing in every edition, std.time, std.drive and std.limit from edition 0.4, and std.collections from edition 0.5. A declaration is identified by its module path and its name, so a user module with such a path could pass its own declarations off as standard ones. The diagnostic points at the module header; give the module a path of its own, and move the file to match it in a package.

The repair at a glance

diff
- module prelude
+ module keys

  pub kind KeyError = UnknownKey | Revoked | Expired

Failing example

una
module prelude

pub kind KeyError = UnknownKey | Revoked | Expired

Fixed example

una
module keys

pub kind KeyError = UnknownKey | Revoked | Expired