12 lines
457 B
Rust
12 lines
457 B
Rust
// The content annotation rejects before allocation or destruction reaches AIR.
|
|
// expect: reject E7005
|
|
// 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; }
|