// The same exclusive borrow lent to two live tasks: a possible data race (E4101). // expect: reject E4101 // phase: 6 // spec: docs/spec/15-source-language.md module demo.same_mut_twice // AIR twin: phase3/reject/tasks_same_mut_twice.air fn bump(s: slice_mut) -> void effects [] { s[0] = s[0] + 1; } fn main() -> u64 effects [task.spawn] { var buf: [u64; 2] = zero; { mut s = buf; scope sc { let a = task.spawn(sc, bump, s); let b = task.spawn(sc, bump, s); // diagnostic here: task.spawn task.join(move a); task.join(move b); } } buf[0] }