-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest dereferencing on E0277 if appropriate #67571
Comments
I would have benefited from this, related forum post: https://users.rust-lang.org/t/methods-that-take-references-to-type-parameter/36088 When writing a method taking &T and comparing to a field T the compiler complains
The suggestion from rustc is:
But fellow rustaceans suggested:
If the compiler could suggest the latter instead it would be a great help :) |
Referencing would help too: fn main() {
takes_ref(Default::default());
}
fn takes_ref(_: &i32) {}
|
Current output:
The above "solves" the issue if you apply the suggestion, but if you follow the earlier advice you get the original suggestion:
I believe that issue falls under #40660, which we should address.
I believe we can close this ticket. |
Suggest
*foo
when<&foo as &Foo>
,Into<Bar>
is expected andBar: From<Foo>
is implemented.The text was updated successfully, but these errors were encountered: