Home / Docs / Diagnostics
U7005: Trusted module not declared in both header and una.toml
Release v0.4.0
A module is declared trusted in its header or in its package's settings, una.toml or from edition 0.4 ita.una, but not in both. U7005 also reports a listed module that the package does not have.
Why Una rejects it
A trusted module may declare information-flow policies (spec/07 §6), so trust is declared twice: the module's header says trusted module, and una.toml lists the module under [trusted] modules, or from edition 0.4 the trusted section of ita.una does. U7005 reports a module declared in only one of the two places, and a listed module that the package does not have.
A file checked on its own has no una.toml and no ita.una, so a trusted module header there is always U7005.
How to fix it
- The repair that keeps the trusted base comes first: remove
trustedfrom the header, or remove the entry from[trusted] modules, as the fixed example does. A policy outside a trusted module is U4004, so narrowing trust never lets a policy through silently. - Completing the declaration in the other place is the last repair, marked as an escape (ADR 0095): the module joins the trusted base.
The repair at a glance
src/keys.una
- trusted module keys
+ module keys
pub pepper() -> Int = 7Failing example
src/keys.una
trusted module keys
pub pepper() -> Int = 7Fixed example
src/keys.una
module keys
pub pepper() -> Int = 7