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

+12 -1
View File
@@ -51,6 +51,16 @@ pub fn print(m: air.Module, w: *Writer) Writer.Error!void {
try w.writeAll("\neffects [");
try list(w, f.effects);
try w.writeAll("]\n");
if (f.trusted) |t| {
try w.writeAll("trusted \"");
for (t) |ch| switch (ch) {
'"' => try w.writeAll("\\\""),
'\\' => try w.writeAll("\\\\"),
'\n' => try w.writeAll("\\n"),
else => try w.writeByte(ch),
};
try w.writeAll("\"\n");
}
for (f.blocks) |b| {
try w.writeAll(b.name);
if (b.params.len != 0) {
@@ -276,7 +286,8 @@ fn printOp(m: air.Module, f: air.Function, op: air.Op, w: *Writer) Writer.Error!
try w.writeByte(' ');
try value(f, x.value, w);
},
.borrow_index => |x| try two(f, w, if (x.proven) "borrow.index.proven" else "borrow.index", x.borrow, x.index),
.borrow_index => |x| try two(f, w, if (x.unchecked) "borrow.index.unchecked" else if (x.proven) "borrow.index.proven" else "borrow.index", x.borrow, x.index),
.assume => |v| try one(f, w, "assume", v),
.slice_make => |v| try one(f, w, "slice.make", v),
.slice_len => |v| try one(f, w, "slice.len", v),
.slice_sub => |x| {