Skip to content

Commit 6d75cdf

Browse files
committed
Added updated compiler diagnostic
1 parent 96229f0 commit 6d75cdf

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ LL | let fp = BufWriter::new(fp);
55
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
66
|
77
= 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`
8+
= note: required by `std::io::BufWriter::<W>::new`
99

1010
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
1111
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
1212
|
1313
LL | let fp = BufWriter::new(fp);
1414
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
15-
|
16-
::: $SRC_DIR/std/src/io/buffered.rs:LL:COL
17-
|
18-
LL | pub struct BufWriter<W: Write> {
19-
| ----- required by this bound in `BufWriter`
2015
|
2116
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
2217

@@ -25,28 +20,18 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
2520
|
2621
LL | let fp = BufWriter::new(fp);
2722
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
28-
|
29-
::: $SRC_DIR/std/src/io/buffered.rs:LL:COL
30-
|
31-
LL | pub struct BufWriter<W: Write> {
32-
| ----- required by this bound in `BufWriter`
3323
|
3424
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
3525

36-
error[E0599]: no method named `write_fmt` found for struct `BufWriter<&dyn std::io::Write>` in the current scope
26+
error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
3727
--> $DIR/mut-borrow-needed-by-trait.rs:22:5
3828
|
39-
LL | writeln!(fp, "hello world").unwrap();
40-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `BufWriter<&dyn std::io::Write>`
41-
|
42-
::: $SRC_DIR/std/src/io/buffered.rs:LL:COL
43-
|
44-
LL | pub struct BufWriter<W: Write> {
45-
| ------------------------------ doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write`
29+
LL | writeln!(fp, "hello world").unwrap();
30+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `std::io::BufWriter<&dyn std::io::Write>`
4631
|
4732
= note: the method `write_fmt` exists but the following trait bounds were not satisfied:
4833
`&dyn std::io::Write: std::io::Write`
49-
which is required by `BufWriter<&dyn std::io::Write>: std::io::Write`
34+
which is required by `std::io::BufWriter<&dyn std::io::Write>: std::io::Write`
5035
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
5136

5237
error: aborting due to 4 previous errors

0 commit comments

Comments
 (0)