Phase 2: unsafe operations and trusted boundaries (RFC 0009)

- air: string literals (trusted line only), trusted obligation on
  functions, assume, borrow.index.unchecked
- verifier: unsafe stage (E6001 outside_boundary /
  trusted_declares_unsafe); effect stage leaves unsafe to it, so trusted
  functions discharge it; assume establishes bounds facts
- interp: T0009 for detected unsafe precondition violations
- aji check --report unsafe: trusted functions with obligations, unsafe
  functions, unsafe operations with their boundary
- feature unsafe published and supported; 10 conformance tests;
  3000 mutants without a crash
This commit is contained in:
dev committed 2026-10-04 14:41:30 +03:00
1 parent c510a37cf9
commit 008654999e
24 files changed
+422 -18

No files matched your search

+3 -1
View File
@@ -18,7 +18,9 @@ pub fn check(c: *Context) !void {
for (f.blocks) |b| for (b.insts) |inst| switch (inst.op) {
.call => |x| {
const callee = m.functions[x.callee];
for (callee.effects) |e| if (!contains(f.effects, e)) {
// `unsafe` is checked by the unsafe stage, which knows about
// `trusted` boundaries (spec 13 §6.4).
for (callee.effects) |e| if (!std.mem.eql(u8, e, "unsafe") and !contains(f.effects, e)) {
try c.report("E3101", inst.span, "callee effect not declared by the caller", &.{
.{ .name = "function", .value = .{ .str = f.name } },
.{ .name = "callee", .value = .{ .str = callee.name } },