Closed
Description
Trait errors should suggest dereferencing just like type errors do in the second error below:
error[E0277]: the trait bound `&rustc_span::def_id::DefId: rustc_middle::ty::query::sealed::IntoQueryParam<rustc_span::def_id::DefId>` is not satisfied
--> compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs:151:39
|
151 | if self.tcx.trait_of_item(item) == Some(trait_ref.def_id) {
| ------------- ^^^^ the trait `rustc_middle::ty::query::sealed::IntoQueryParam<rustc_span::def_id::DefId>` is not implemented for `&rustc_span::def_id::DefId`
| |
| required by a bound introduced by this call
error[E0308]: mismatched types
--> compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs:152:49
|
152 | let method = self.tcx.item_name(item);
| ^^^^ expected struct `rustc_span::def_id::DefId`, found `&rustc_span::def_id::DefId`
|
help: consider dereferencing the borrow
|
152 | let method = self.tcx.item_name(*item);
| +
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.