; stdin is read from the run inputs and echoed to stdout. ; expect: run ; grant: in=io.read ; grant: out=io.write ; stdin: echo me ; result: null ; stdout: echo me ; phase: 2 ; spec: docs/reference/intrinsics.md module test.echo_stdin air 0 lang 0.1 features [arrays, capabilities, effects, ownership, resources] fn @main(%in: cap, %out: cap) -> void effects [io.read, io.write] entry: %b = local.alloc array local.zero %b %m = borrow.mut %b %s = slice.make %m intrinsic io.stdin_read(%in, %s), ok -> @got, err -> @fail got(%n: usize): %z = const.usize 0 %part = slice.sub %s, %z, %n %pr = borrow.ref %part intrinsic io.stdout_write(%out, %pr), ok -> @done, err -> @fail2 done: borrow.end %pr borrow.end %part borrow.end %s borrow.end %m ret fail(%e: io_error): trap fail2(%e2: io_error): trap