Skip to content

Commit

Permalink
Rebase and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Nov 5, 2022
1 parent 7e38c8a commit 7df4b0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if static_candidates.len() == 1 {
let mut has_unsuggestable_args = false;
let ty_str = if let Some(CandidateSource::Impl(impl_did)) =
static_candidates.get(0)
static_candidates.get(0)
{
// When the "method" is resolved through dereferencing, we really want the
// original type that has the associated function for accurate suggestions.
Expand Down Expand Up @@ -453,7 +453,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.ty_to_value_string(actual.peel_refs())
};
if let SelfSource::MethodCall(_) = source {
let first_arg = if let Some(CandidateSource::Impl(impl_did)) = static_sources.get(0) &&
let first_arg = if let Some(CandidateSource::Impl(impl_did)) = static_candidates.get(0) &&
let Some(assoc) = self.associated_value(*impl_did, item_name) {
let sig = self.tcx.fn_sig(assoc.def_id);
if let Some(first) = sig.inputs().skip_binder().get(0) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/suggestions/issue-102354.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LL | fn func() {}
help: use associated function syntax instead
|
LL | i32::func();
| ~~~~~~~~~
| ~~~~~~~~~~~
help: disambiguate the associated function for the candidate
|
LL | <i32 as Trait>::func(x);
Expand Down

0 comments on commit 7df4b0b

Please sign in to comment.