13 lines
503 B
Rust
13 lines
503 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 boxit<T: Copy>(heap: cap<mem.alloc>, x: T) -> own<T> effects [mem.alloc] { return own.new(x, heap) or trap; }
|
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
|
let p = boxit::<cap<mem.alloc>>(heap, heap);
|
|
let cap = own.take(move p);
|
|
let q = boxit::<u64>(cap, 42u64); return own.take(move q);
|
|
}
|