12 lines
475 B
Rust
12 lines
475 B
Rust
// Allocation and destruction each reject the borrow element at their own source construct.
|
|
// expect: reject E1001 E1001
|
|
// grant: heap=mem.alloc:128
|
|
// phase: 6
|
|
// spec: docs/spec/03-memory-model.md §26; docs/spec/15-source-language.md §17
|
|
module test.buffers
|
|
fn bad(heap: cap<mem.alloc>, value: ref<u64>) -> void effects [mem.alloc] {
|
|
let data = buffer.new<ref<u64>>(1, heap) or trap;
|
|
buffer.free(move data) or trap;
|
|
}
|
|
fn main() -> u64 effects [] { return 42; }
|