Closed
Description
When both &S
and &mut S
is implemented,
Given the following code:
trait Tr {}
struct S {}
impl Tr for &S {}
impl Tr for &mut S {}
fn foo<T: Tr>(t: T) {}
fn main() {
let s = S {};
foo(s);
}
The previous output was:
error[E0277]: the trait bound `S: Tr` is not satisfied
--> src/main.rs:11:9
|
7 | fn foo<T: Tr>(t: T) {}
| -- required by this bound in `foo`
...
11 | foo(s);
| ^ the trait `Tr` is not implemented for `S`
|
= help: the following implementations were found:
<&S as Tr>
<&mut S as Tr>
The current output is:
error[E0277]: the trait bound `S: Tr` is not satisfied
--> src/main.rs:11:9
|
7 | fn foo<T: Tr>(t: T) {}
| -- required by this bound in `foo`
...
11 | foo(s);
| ^
| |
| expected an implementor of trait `Tr`
| help: consider borrowing here: `&s`
Ideally the output should look like:
Not sure but it should show both &s
and &mut s
. The previous output seemed to do a better job there. Maybe we could keep the last part of the previous output.
= help: the following implementations were found:
<&S as Tr>
<&mut S as Tr>
Caused by #85369, although it is better in the sense it is more specific but I think it omitted quite some useful details.