; After an island is sent, the sender holds nothing that reaches it: a later use is E2001. ; expect: reject E2001 ; phase: 4 ; spec: docs/spec/03-memory-model.md module test.island_use_after_send air 0 lang 0.1 features [cancellation, capabilities, channels, effects, heap, islands, ownership, resources, tasks] fn @main(%heap: cap) -> u64 effects [mem.alloc, task.wait] entry: %one = const.usize 1 channel.make island, %one, %heap, ok -> @made, err -> @oom made(%tx: sender>, %rx: receiver>): %v = const.u64 1 island.create %v, %heap, ok -> @built, err -> @oom2 built(%i: island): %txb = borrow.mut %tx channel.send %txb, %i, ok -> @sent, closed -> @fail, cancelled -> @fail sent: borrow.end %txb %g = borrow.ref %i borrow.end %g channel.close_sender %tx %rxb = borrow.mut %rx channel.recv %rxb, ok -> @got, closed -> @none, cancelled -> @none got(%back: island): borrow.end %rxb island.destroy %back channel.close_receiver %rx, ok -> @done, pending -> @pending none: trap done: ret %v pending(%r: receiver>): trap fail(%x: island): trap oom(%e: alloc_error): trap oom2(%e2: alloc_error): trap