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
@@ -17,6 +17,7 @@ pub const cfg = @import("verifier/cfg.zig");
pub const ssa = @import("verifier/ssa.zig");
pub const types = @import("verifier/types.zig");
pub const effects = @import("verifier/effects.zig");
pub const unsafe_ = @import("verifier/unsafe.zig");
pub const init = @import("verifier/init.zig");
pub const borrow = @import("verifier/borrow.zig");
pub const bounds = @import("verifier/bounds.zig");
@@ -61,7 +62,7 @@ pub const Context = struct {
/// stage, or an empty slice if the module verifies.
pub fn verify(arena: std.mem.Allocator, file: []const u8, module: air.Module) std.mem.Allocator.Error![]const diag.Diagnostic {
var c: Context = .{ .arena = arena, .file = file, .module = module };
const stages = .{ budget.check, cfg.check, ssa.check, types.check, effects.check, init.check, borrow.check, bounds.check };
const stages = .{ budget.check, cfg.check, ssa.check, types.check, effects.check, unsafe_.check, init.check, borrow.check, bounds.check };
inline for (stages) |stage| {
try stage(&c);
if (c.diags.items.len != 0) {
@@ -86,6 +87,7 @@ test {
_ = ssa;
_ = types;
_ = effects;
_ = unsafe_;
_ = init;
_ = borrow;
_ = bounds;