]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / suggestions / mut-borrow-needed-by-trait.stderr
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
3 |
4 LL | let fp = BufWriter::new(fp);
5 | ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
6 |
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`
9 --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
10 |
11 LL | pub fn new(inner: W) -> BufWriter<W> {
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
14 error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
15 --> $DIR/mut-borrow-needed-by-trait.rs:17:14
16 |
17 LL | let fp = BufWriter::new(fp);
18 | ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
19 |
20 ::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
21 |
22 LL | pub struct BufWriter<W: Write> {
23 | ----- required by this bound in `BufWriter`
24 |
25 = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
26
27 error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn std::io::Write>`, but its trait bounds were not satisfied
28 --> $DIR/mut-borrow-needed-by-trait.rs:21:5
29 |
30 LL | writeln!(fp, "hello world").unwrap();
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn std::io::Write>` due to unsatisfied trait bounds
32 |
33 ::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
34 |
35 LL | pub struct BufWriter<W: Write> {
36 | ------------------------------ doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
37 |
38 = note: the following trait bounds were not satisfied:
39 `&dyn std::io::Write: std::io::Write`
40 which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
41 = note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
42
43 error: aborting due to 3 previous errors
44
45 Some errors have detailed explanations: E0277, E0599.
46 For more information about an error, try `rustc --explain E0277`.