// A second lock while one is held waits while locked (E4304): lock-order deadlocks cannot be written. // expect: reject E4304 // phase: 6 // spec: docs/spec/15-source-language.md module demo.lock_twice // AIR twin: phase3/reject/sync_lock_twice.air fn main() -> u64 effects [task.wait] { let a = mutex.make(0u64); let b = mutex.make(0u64); lock ref a as x { lock ref b as y { // diagnostic here *y = *x; } cancelled {} } cancelled {} mutex.take(move a) + mutex.take(move b) }