Skip to content

Commit 1d52917

Browse files
committed
gccrs: simplify matching possible candidates
We do extra checking after the fact here to ensure its a valid candidate and in the case there is only one candidate lets just go for it. Addresses #1895 gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): use the single candidate Signed-off-by: Philip Herron <[email protected]>
1 parent 086b7f9 commit 1d52917

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gcc/rust/backend/rust-compile-base.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,12 @@ HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
843843
// look for the exact fntype
844844
for (auto &candidate : filteredFunctionCandidates)
845845
{
846+
if (filteredFunctionCandidates.size () == 1)
847+
{
848+
selectedCandidate = &candidate;
849+
break;
850+
}
851+
846852
bool compatable
847853
= Resolver::types_compatable (TyTy::TyWithLocation (candidate.ty),
848854
TyTy::TyWithLocation (fntype), expr_locus,

0 commit comments

Comments
 (0)