14 lines
493 B
Rust
14 lines
493 B
Rust
// own.new receives cap<fs.read> where the allocation needs cap<mem.alloc>.
|
|
// phase: 6
|
|
// spec: docs/spec/05-effects-and-capabilities.md §10.5
|
|
// expect: reject E3201
|
|
// AIR twin: phase2/reject/alloc_wrong_capability.air
|
|
module test.source_alloc_wrong_capability
|
|
fn f(heap: cap<fs.read>) -> void effects [mem.alloc] {
|
|
match own.new(1u64, heap) { // diagnostic here: own.new
|
|
ok(o) => { own.free(move o); }
|
|
err(e) => {}
|
|
}
|
|
}
|
|
fn main() -> u64 effects [] { return 0u64; }
|