diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index 499b9ac481ce..c2ac15d6b02c 100644 --- a/gcc/rust/backend/rust-compile-base.cc +++ b/gcc/rust/backend/rust-compile-base.cc @@ -843,6 +843,12 @@ HIRCompileBase::resolve_method_address (TyTy::FnType *fntype, // look for the exact fntype for (auto &candidate : filteredFunctionCandidates) { + if (filteredFunctionCandidates.size () == 1) + { + selectedCandidate = &candidate; + break; + } + bool compatable = Resolver::types_compatable (TyTy::TyWithLocation (candidate.ty), TyTy::TyWithLocation (fntype), expr_locus,