Skip to content

Commit f5e372a

Browse files
committed
Tweak wording
1 parent 55ecb79 commit f5e372a

File tree

8 files changed

+12
-11
lines changed

8 files changed

+12
-11
lines changed

src/librustc/traits/error_reporting.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1164,9 +1164,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11641164
);
11651165
} else {
11661166
err.note(&format!(
1167-
"`{}` is implemented for `{:?}`",
1167+
"`{}` is implemented for `{:?}`, but not for `{:?}`",
11681168
trait_ref,
11691169
trait_type,
1170+
trait_ref.skip_binder().self_ty(),
11701171
));
11711172
}
11721173
}

src/librustc_typeck/check/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
575575
hir::Mutability::MutImmutable => self.tcx.mk_mut_ref(region, t_type),
576576
};
577577
if needs_mut {
578-
err.note(&format!("you need `{}` instead", trait_type));
578+
err.note(&format!("you need `{}` instead of `{}`", trait_type, rcvr_ty));
579579
}
580580
}
581581
err.emit();

src/test/ui/not-panic/not-panic-safe.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | assert::<&mut i32>();
88
| ^^^^^^^^^^^^^^^^^^ `&mut i32` may not be safely transferred across an unwind boundary
99
|
1010
= help: the trait `std::panic::UnwindSafe` is not implemented for `&mut i32`
11-
= note: `std::panic::UnwindSafe` is implemented for `&i32`
11+
= note: `std::panic::UnwindSafe` is implemented for `&i32`, but not for `&mut i32`
1212

1313
error: aborting due to previous error
1414

src/test/ui/parser/lex-bad-char-literals-6.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ LL | if x == y {}
3535
| ^^ no implementation for `&str == char`
3636
|
3737
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
38-
= note: `std::cmp::PartialEq<char>` is implemented for `&mut str`
38+
= note: `std::cmp::PartialEq<char>` is implemented for `&mut str`, but not for `&str`
3939

4040
error[E0308]: mismatched types
4141
--> $DIR/lex-bad-char-literals-6.rs:15:20
@@ -53,7 +53,7 @@ LL | if x == z {}
5353
| ^^ no implementation for `&str == char`
5454
|
5555
= help: the trait `std::cmp::PartialEq<char>` is not implemented for `&str`
56-
= note: `std::cmp::PartialEq<char>` is implemented for `&mut str`
56+
= note: `std::cmp::PartialEq<char>` is implemented for `&mut str`, but not for `&str`
5757

5858
error: aborting due to 6 previous errors
5959

src/test/ui/suggestions/imm-ref-trait-object.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: the `min` method cannot be invoked on a trait object
44
LL | t.min().unwrap()
55
| ^^^
66
|
7-
= note: you need `&mut dyn std::iter::Iterator<Item = &u64>` instead
7+
= note: you need `&mut dyn std::iter::Iterator<Item = &u64>` instead of `&dyn std::iter::Iterator<Item = &u64>`
88

99
error: aborting due to previous error
1010

src/test/ui/suggestions/into-str.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | foo(String::new());
88
| ^^^ the trait `std::convert::From<std::string::String>` is not implemented for `&str`
99
|
1010
= note: to coerce a `std::string::String` into a `&str`, use `&*` as a prefix
11-
= note: `std::convert::From<std::string::String>` is implemented for `&mut str`
11+
= note: `std::convert::From<std::string::String>` is implemented for `&mut str`, but not for `&str`
1212
= note: required because of the requirements on the impl of `std::convert::Into<&str>` for `std::string::String`
1313

1414
error: aborting due to previous error

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
44
LL | let fp = BufWriter::new(fp);
55
| ^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
66
|
7-
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`
7+
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
88
= 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
@@ -13,7 +13,7 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
1313
LL | let fp = BufWriter::new(fp);
1414
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
1515
|
16-
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`
16+
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
1717
= note: required by `std::io::BufWriter`
1818

1919
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
@@ -22,7 +22,7 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
2222
LL | let fp = BufWriter::new(fp);
2323
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
2424
|
25-
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`
25+
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
2626
= note: required by `std::io::BufWriter`
2727

2828
error[E0599]: no method named `write_fmt` found for type `std::io::BufWriter<&dyn std::io::Write>` in the current scope

src/test/ui/suggestions/suggest-remove-refs-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | for (i, n) in &v.iter().enumerate() {
88
| help: consider removing 1 leading `&`-references
99
|
1010
= help: the trait `std::iter::Iterator` is not implemented for `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`
11-
= note: `std::iter::Iterator` is implemented for `&mut std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`
11+
= note: `std::iter::Iterator` is implemented for `&mut std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`, but not for `&std::iter::Enumerate<std::slice::Iter<'_, {integer}>>`
1212
= note: required by `std::iter::IntoIterator::into_iter`
1313

1414
error: aborting due to previous error

0 commit comments

Comments
 (0)