13 lines
537 B
Rust
13 lines
537 B
Rust
// expect: run
|
|
// result: 42
|
|
// grant: heap=mem.alloc:128
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §10/§16; docs/spec/03-memory-model.md §25
|
|
module test.inferred_content
|
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
|
let graph = island.create(42u64, heap) or trap;
|
|
var answer: u64 = 0;
|
|
{ ref g = graph; let root = island.root(g); let p = own.new(root, heap) or trap; let again = own.take(move p); ref value = island.at(g, again); answer = *value; }
|
|
island.destroy(move graph); return answer;
|
|
}
|