1 error[E0277]: the trait bound `&T: std::io::Read` is not satisfied
2 --> $DIR/suggest-change-mut.rs:12:48
4 LL | let mut stream_reader = BufReader::new(&stream);
5 | ^^^^^^^ the trait `std::io::Read` is not implemented for `&T`
7 = note: required by `BufReader::<R>::new`
8 help: consider removing the leading `&`-reference
10 LL | let mut stream_reader = BufReader::new(stream);
12 help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
14 LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read {
15 | ^^^^^^^^^^^^^^^^^^^^^^^
16 help: consider changing this borrow's mutability
18 LL | let mut stream_reader = BufReader::new(&mut stream);
21 error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied
22 --> $DIR/suggest-change-mut.rs:16:23
24 LL | stream_reader.read_until(b'\n', &mut buffer).expect("Reading into buffer failed");
25 | ^^^^^^^^^^ method cannot be called on `BufReader<&T>` due to unsatisfied trait bounds
27 ::: $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL
29 LL | pub struct BufReader<R> {
30 | ----------------------- doesn't satisfy `BufReader<&T>: BufRead`
32 = note: the following trait bounds were not satisfied:
34 which is required by `BufReader<&T>: BufRead`
36 error: aborting due to 2 previous errors
38 Some errors have detailed explanations: E0277, E0599.
39 For more information about an error, try `rustc --explain E0277`.