unsafe Is Listed — a Ledger Column per Function and --unsafe Over the Program and Every DependencyStatus: Accepted
Date: November 8, 2026 (supervisor’s decision, by the language principles; asked by the owner)
Answers: how a reader, a reviewer or a CI job sees, without reading every
file, where a program and the packages it depends on step outside what the
compiler checks
Related: ADR-376 (unsafe { assume(…) }), ADR-c-boundary-v1
(calls into C are written inside unsafe), ADR-378 (the emitted
code is unsafe only where a switch or the program says so), ADR-218
(the toolchain’s own unsafe lives in small crates), ADR-365 D2
and #1357 (the trusted column, the pattern this follows), ADR-100
(a dependency’s ledger and --locked), Part III 13.5
A Nikaia program is unsafe in two places only: a claim it vouches for,
unsafe { assume(…) }, and a call into C. A build that drops proved checks
(remove-bounds-checks:on, remove-overflow-checks:on) adds unsafe of the
compiler’s own. nikaia check --asserts lists the assumes of the package it
checks, but nothing lists every unsafe site of a program together with those
of its dependencies, and a dependency that gains one shows nowhere.
unsafe sites.A function’s entry in nikaia.contracts holds unsafe = ["assume at
main.nika:12", "extern sqlite3_open at db.nika:40"]: every unsafe { … }
in its body, each as its kind (assume, or extern with the foreign
function’s name) and its place, the file named as [sources] names it,
sorted by place, absent when empty. Because the ledger is committed, a new
unsafe site shows in the diff, and --locked fails until it is committed,
in the program and in every dependency (ADR-100).
--unsafe lists them over the program and its dependencies.nikaia build --unsafe (and check and lower) prints every unsafe site
of the program and of every package it reaches, read from their ledgers,
grouped by package; then each Rust crate the build depends on, as a crate
that can hold unsafe of its own, with whether a description covers it
(ADR-rust-boundary-1); then, where the build’s remove-* switches are on, how many
checks they drop by kind (each a nikaia_std::proven call, ADR-378 D2). A
program with no line under the first heading and its switches off has no
unsafe it did not write, and says so in one line.
unsafe-sites = "none" in a package’s nikaia.toml refuses a build that
finds an unsafe site in the package itself (NK1360); unsafe-sites =
"listed" (the default) only lists them. A dependency is judged by its own
ledger, which --unsafe shows.
unsafe site in
a dependency is a diff line.trusted column’s: the compiler writes, the diff shows,
--locked holds.