Files
aji/tests/conformance/source/layer9/reject/two_mut_access.aji
T

22 lines
565 B
Rust

// One mutable access per island at a time, even through different irefs.
// expect: reject E2101
// phase: 6
// spec: docs/spec/03-memory-model.md
module demo.two_mut_access
// AIR twin: phase4/reject/island_two_mut.air
fn main(heap: cap<mem.alloc>) -> u64
effects [mem.alloc]
{
let isl = island.create(1u64, heap) or trap;
{
mut g = isl;
let a = island.root(g);
let b = island.alloc(g, 2u64) or trap;
mut x = island.at(g, a);
mut y = island.at(g, b); // diagnostic here
}
island.destroy(move isl);
0
}