3 use std::io::{BufRead, BufReader, Read, Write};
5 fn issue_81421<T: Read + Write>(mut stream: T) { //~ HELP consider introducing a `where` bound
6 let initial_message = format!("Hello world");
7 let mut buffer: Vec<u8> = Vec::new();
8 let bytes_written = stream.write_all(initial_message.as_bytes());
9 let flush = stream.flush();
12 let mut stream_reader = BufReader::new(&stream);
13 //~^ ERROR the trait bound `&T: std::io::Read` is not satisfied [E0277]
14 //~| HELP consider removing the leading `&`-reference
15 //~| HELP consider changing this borrow's mutability
16 stream_reader.read_until(b'\n', &mut buffer).expect("Reading into buffer failed");
17 //~^ ERROR the method `read_until` exists for struct `BufReader<&T>`,