fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
2.5 KiB55 linesraw
1error[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   |
4LL |     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 `std::io::BufWriter::<W>::new`
9
10error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
11  --> $DIR/mut-borrow-needed-by-trait.rs:17:14
12   |
13LL |     let fp = BufWriter::new(fp);
14   |              ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
15   | 
16  ::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
17   |
18LL | pub struct BufWriter<W: Write> {
19   |                         ----- required by this bound in `std::io::BufWriter`
20   |
21   = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
22
23error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
24  --> $DIR/mut-borrow-needed-by-trait.rs:17:14
25   |
26LL |     let fp = BufWriter::new(fp);
27   |              ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
28   | 
29  ::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
30   |
31LL | pub struct BufWriter<W: Write> {
32   |                         ----- required by this bound in `std::io::BufWriter`
33   |
34   = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
35
36error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
37  --> $DIR/mut-borrow-needed-by-trait.rs:22:5
38   |
39LL |     writeln!(fp, "hello world").unwrap();
40   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `std::io::BufWriter<&dyn std::io::Write>`
41   | 
42  ::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
43   |
44LL | pub struct BufWriter<W: Write> {
45   | ------------------------------ doesn't satisfy `_: std::io::Write`
46   |
47   = note: the method `write_fmt` exists but the following trait bounds were not satisfied:
48           `&dyn std::io::Write: std::io::Write`
49           which is required by `std::io::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)
51
52error: aborting due to 4 previous errors
53
54Some errors have detailed explanations: E0277, E0599.
55For more information about an error, try `rustc --explain E0277`.