Skip to content

Commit

Permalink
Ignore auto-deref for multiple crate version note
Browse files Browse the repository at this point in the history
As per the case presented in #128569, we should be showing the extra info even if auto-deref is involved.
  • Loading branch information
estebank committed Aug 7, 2024
1 parent d03d9a2 commit 13a7918
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3491,21 +3491,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// self types and rely on the suggestion to `use` the trait from
// `suggest_valid_traits`.
let did = Some(pick.item.container_id(self.tcx));
let skip = skippable.contains(&did);
if pick.autoderefs == 0 && !skip {
suggest = self.detect_and_explain_multiple_crate_versions(
err,
pick.item.def_id,
if skippable.contains(&did) {
continue;
}
suggest = self.detect_and_explain_multiple_crate_versions(
err,
pick.item.def_id,
pick.item.ident(self.tcx).span,
rcvr.hir_id.owner,
*rcvr_ty,
);
if pick.autoderefs == 0 && suggest {
err.span_label(
pick.item.ident(self.tcx).span,
rcvr.hir_id.owner,
*rcvr_ty,
format!("the method is available for `{rcvr_ty}` here"),
);
if suggest {
err.span_label(
pick.item.ident(self.tcx).span,
format!("the method is available for `{rcvr_ty}` here"),
);
}
}
break;
}
Expand Down

0 comments on commit 13a7918

Please sign in to comment.