1 error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
2 --> $DIR/mut-borrow-needed-by-trait.rs:17:29
4 LL | let fp = BufWriter::new(fp);
5 | -------------- ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
7 | required by a bound introduced by this call
9 = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
10 note: required by a bound in `BufWriter::<W>::new`
11 --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
13 error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
14 --> $DIR/mut-borrow-needed-by-trait.rs:17:14
16 LL | let fp = BufWriter::new(fp);
17 | ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
19 = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
20 note: required by a bound in `BufWriter`
21 --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
23 error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn Write>`, but its trait bounds were not satisfied
24 --> $DIR/mut-borrow-needed-by-trait.rs:21:5
26 LL | writeln!(fp, "hello world").unwrap();
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
28 --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
30 = note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
32 = note: the following trait bounds were not satisfied:
33 `&dyn std::io::Write: std::io::Write`
34 which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
35 = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
37 error: aborting due to 3 previous errors
39 Some errors have detailed explanations: E0277, E0599.
40 For more information about an error, try `rustc --explain E0277`.