]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/suggest-change-mut.rs
Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid
[rust.git] / src / test / ui / suggestions / suggest-change-mut.rs
1 #![allow(warnings)]
2
3 use std::io::{BufRead, BufReader, Read, Write};
4
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();
10
11     loop {
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>`,
18     }
19 }
20
21 fn main() {}