@@ -10,6 +10,16 @@ LL | let fp = BufWriter::new(fp);
10
10
note: required by a bound in `BufWriter::<W>::new`
11
11
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
12
12
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
15
+ |
16
+ LL | let fp = BufWriter::new(fp);
17
+ | ^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
18
+ |
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
22
+
13
23
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
14
24
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
15
25
|
@@ -21,21 +31,21 @@ note: required by a bound in `BufWriter`
21
31
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
22
32
23
33
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 :14
34
+ --> $DIR/mut-borrow-needed-by-trait.rs:22 :14
25
35
|
26
36
LL | writeln!(fp, "hello world").unwrap();
27
37
| ---------^^---------------- method cannot be called on `BufWriter<&dyn Write>` due to unsatisfied trait bounds
28
38
|
29
39
note: must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method
30
- --> $DIR/mut-borrow-needed-by-trait.rs:21 :14
40
+ --> $DIR/mut-borrow-needed-by-trait.rs:22 :14
31
41
|
32
42
LL | writeln!(fp, "hello world").unwrap();
33
43
| ^^
34
44
= note: the following trait bounds were not satisfied:
35
45
`&dyn std::io::Write: std::io::Write`
36
46
which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
37
47
38
- error: aborting due to 3 previous errors
48
+ error: aborting due to 4 previous errors
39
49
40
50
Some errors have detailed explanations: E0277, E0599.
41
51
For more information about an error, try `rustc --explain E0277`.
0 commit comments