// expect: reject E2101 // phase: 6 // spec: docs/spec/16-standard-library.md ยง2.18 module test.buffered import std.io; import std.io.reader; import std.io.writer; import std.option; fn reader(file: file,capacity: usize,heap: cap) -> std.io.reader.Reader effects [mem.alloc] { match std.io.reader.new(move file,capacity,heap) { std.io.reader.NewResult::ok(value) => { return move value; }, std.io.reader.NewResult::err(error) => { trap; } } } fn writer(file: file,capacity: usize,heap: cap) -> std.io.writer.Writer effects [mem.alloc] { match std.io.writer.new(move file,capacity,heap) { std.io.writer.NewResult::ok(value) => { return move value; }, std.io.writer.NewResult::err(error) => { trap; } } } 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 written(result: std.io.writer.WriteResult) -> void effects [] { match result { std.io.writer.WriteResult::ok => {}, std.io.writer.WriteResult::err(error) => { trap; } } } fn finished_reader(value: std.io.reader.Reader) -> file effects [] { match std.io.reader.finish(move value) { std.io.reader.FinishResult::ok(file) => { return move file; }, std.io.reader.FinishResult::unread(value) => { trap; } } } fn finished_writer(value: std.io.writer.Writer) -> file effects [fs.write] { match std.io.writer.finish(move value) { std.io.writer.FinishResult::ok(file) => { return move file; }, std.io.writer.FinishResult::err(error) => { trap; } } } fn bad(q: mut) -> void effects [fs.write] { ref storage = q.storage; ref bytes = buffer.view(storage); std.io.writer.write(q,bytes); } fn main() -> u64 effects [] { return 42; }