Files
aji/tests/conformance/source/store_modes/own_array.aji
T

10 lines
373 B
Rust

// expect: run
// result: 42
// grant: heap=mem.alloc:128
// phase: 6
// spec: docs/spec/15-source-language.md §5/§10
module test.store_modes
struct Pair { a: u64 }
struct Box { pair: Pair, data: [u64; 2] }
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] { let x = own.array(2usize, 0u64, heap) or trap; x[0] = 42u64; let n = x[0]; own.free(move x); return n; }