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