; A trusted function wraps an unchecked access; its callers stay safe. ; expect: accept ; phase: 2 ; spec: docs/spec/13-contracts-and-unsafe.md module test.unsafe_trusted_boundary air 0 lang 0.1 features [arrays, effects, ownership, unsafe] fn @get(%s: slice, %i: usize) -> u8 effects [] trusted "callers pass %i < slice.len(%s)" entry: %e = borrow.index.unchecked %s, %i %v = load %e borrow.end %e ret %v fn @main() -> u8 effects [] entry: %x = local.alloc array %nine = const.u8 9 %a = array.splat array %nine local.store %x, %a %r = borrow.ref %x %s = slice.make %r %i = const.usize 1 %v = call @get(%s, %i) borrow.end %s borrow.end %r ret %v