Files
aji/tests/conformance/source/layer8/reject/call_waiting_function.aji
T

23 lines
487 B
Rust

// Calling a function whose effects include task.wait inside a `lock` block is E4304.
// expect: reject E4304
// phase: 6
// spec: docs/spec/15-source-language.md
module demo.call_waiting_function
// AIR twin: phase3/reject/sync_call_waiting_function.air
fn pause() -> void
effects [task.wait]
{
}
fn main() -> u64
effects [task.wait]
{
let m = mutex.make(0u64);
lock ref m as c {
pause(); // diagnostic here
*c = 1;
} cancelled {}
mutex.take(move m)
}