rust/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr

47 lines
2.2 KiB
Plaintext
Raw Normal View History

error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
--> $DIR/mut-borrow-needed-by-trait.rs:17:29
|
LL | let fp = BufWriter::new(fp);
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
2019-10-03 19:39:58 -05:00
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
note: required by `BufWriter::<W>::new`
--> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
|
LL | pub fn new(inner: W) -> BufWriter<W> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
LL | let fp = BufWriter::new(fp);
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
2020-09-16 22:52:41 -05:00
|
::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
|
LL | pub struct BufWriter<W: Write> {
| ----- required by this bound in `BufWriter`
|
2019-10-03 19:39:58 -05:00
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn std::io::Write>`, but its trait bounds were not satisfied
2021-05-20 09:15:56 -05:00
--> $DIR/mut-borrow-needed-by-trait.rs:21:5
|
2020-09-16 22:52:41 -05:00
LL | writeln!(fp, "hello world").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn std::io::Write>` due to unsatisfied trait bounds
2020-09-16 22:52:41 -05:00
|
::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL
|
LL | pub struct BufWriter<W: Write> {
| ------------------------------ doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
|
= note: the following trait bounds were not satisfied:
`&dyn std::io::Write: std::io::Write`
2020-09-16 22:52:41 -05:00
which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
= note: this error originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
2021-05-20 09:15:56 -05:00
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.