// On the `cancelled` edge of task.join_cancel the task is not joined: its loans stay, so touching the lent data is E4101. // expect: reject E4101 // phase: 6 // spec: docs/spec/15-source-language.md module demo.cancelled_keeps_loans fn bump(s: slice_mut) -> u64 effects [] { s[0] = s[0] + 1; s[0] } fn main() -> u64 effects [task.spawn, task.wait] { var buf: [u64; 2] = zero; var r: u64 = 0; { mut s = buf; scope sc { let t = task.spawn(sc, bump, s); match task.join_cancel(move t) { ok(v) => { r = v; } cancelled(t) => { s[0] = 9; r = task.join(move t); } } } } r }