Open and answer this issue on GitHub.
compiler, ready · opened 2026-11-15 · updated 2026-11-15 · 0 comments
Part of #1626. Step 5 of 5 of ADR-shared-handle-cycles-1. It rests on #1648 (function summaries) and #1649 (back fields).
After #1648, a call into another package has no summary, so it is judged conservatively: the result may reach every argument, and every self-reaching argument may be stored into. Correct programs that use a package’s handle types are then refused. With this issue, each package writes the summaries of its public functions into its interface, and a program that uses the package reads them.
A package nodes with pub fn fresh(name: String) -> SharedMut[Node] and pub fn link(from: SharedMut[Node], to: SharedMut[Node]), as in #1648’s probe, and a program in another package:
use nodes.{fresh, link}
fn main() throws {
let a = fresh("a")
let b = fresh("b")
link(a, b)
print("linked")
}
NK1352 (unknown: a call into nodes without a summary), because fresh may reach a.linked. With let b = ... built from a instead, link(a, b) is refused at the call, as in #1648.The probe compiles, the refusing variant is refused, the tests below pass, and measurement 5 of #1626 §9 is posted with the package part.
check_cycles.nika, in place of the conservative summary.tests/compiler/tests/ with a package beside it, whichever form the other cross-package tests use):
a_call_into_a_package_uses_its_cycle_summary (the probe, .stdout);a_cycle_closed_through_a_package_function_is_refused (.stderr);a_package_without_summaries_is_judged_conservatively (.stderr);a_back_field_proved_in_a_package_holds_in_the_program (.stdout).packages/ and examples/, refusals for unknown: package before and after.crates/nikaia-std/src/tools/check_cycles.nika, the package interface writer and reader, their lowered .rs; the new tests.