Files
aji/tests/conformance/source/io/loan.aji
T
dev 3e1c0f34e8 cli: add explicit bounded standard I/O composition
Add std.io exact stdin/file/TCP reads, bounded file read-to-end and
limited file write/append copies. Use caller slices and resource loans,
exact effects, explicit EOF/capacity/limit and confirmed partial progress.
No implicit heap, open/close, timeout or new AIR/runtime semantics.

Document failure limits and check hosted read errors and a partial
external file write under a child-only file-size quota. Integrate
normative contracts, RFC, source reference budgets, CLI/profile/package
checks and independent byte/count/cursor vectors.

Validation: 1027 conformance cases, 20 I/O GC cases, scheduled stress,
unit/Quick Reference, formatting, hosted smoke, 55 CLI checks, 111 source
coverage constructs and unchanged AIR reference bundle.
2026-10-07 12:14:11 +03:00

13 lines
746 B
Rust

// expect: reject E4101
// phase: 6
// spec: docs/spec/16-standard-library.md §2.17
module test.io
import std.io;
fn exact(result: std.io.ReadExactResult) -> void effects [] {
match result { std.io.ReadExactResult::ok => {}, std.io.ReadExactResult::eof(count) => { trap; }, std.io.ReadExactResult::err(error) => { trap; } }
}
fn worker(input: cap<io.read>,destination: slice_mut<u8>) -> void effects [io.read] { exact(std.io.read_exact_stdin(input,destination)); }
fn bad(input: cap<io.read>,destination: slice_mut<u8>) -> void effects [io.read,task.spawn,task.wait] {
scope s { let task = task.spawn(s,worker,input,destination); std.io.read_exact_stdin(input,destination); task.join(move task); }
} fn main() -> u64 effects [] { return 42; }