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

10 lines
359 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.new(0u64, heap) or trap; { mut p = x; *p = 42u64; } return own.take(move x); }