; own.array of runtime length, borrowed as a slice. ; expect: run ; grant: heap=mem.alloc:64 ; result: [7,7,9,7,7] ; phase: 2 ; spec: docs/spec/03-memory-model.md module test.own_array_buffer air 0 lang 0.1 features [arrays, capabilities, effects, heap, ownership, resources] fn @main(%heap: cap) -> array effects [mem.alloc] entry: %dst = local.alloc array local.zero %dst %n = const.usize 5 %seven = const.u8 7 own.array %n, %seven, %heap, ok -> @have, err -> @nomem have(%a: own_array): %s = borrow.mut %a %i = const.usize 2 %el = borrow.index %s, %i %nine = const.u8 9 store %el, %nine borrow.end %el %src = borrow.ref %s %dm = borrow.mut %dst %ds = slice.make %dm slice.copy %ds, %src borrow.end %ds borrow.end %dm borrow.end %src borrow.end %s own.free %a %r = local.load %dst ret %r nomem(%e: alloc_error): trap