// own.new is matched over its outcomes; the owner is borrowed in place, moved explicitly and taken. // expect: run // grant: heap=mem.alloc:64 // result: 42 // phase: 6 // spec: docs/spec/15-source-language.md module demo.ownbasic fn bump(c: mut) -> void effects [] { *c = *c + 1; } fn main(heap: cap) -> u64 effects [mem.alloc] { match own.new(41u64, heap) { ok(x) => { bump(mut x); own.take(move x) } err(e) => 0, } }