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