Skip to content

Commit

Permalink
gccrs: simplify matching possible candidates
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
philberty committed Aug 12, 2023
1 parent 086b7f9 commit 1d52917
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/rust/backend/rust-compile-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1d52917

Please sign in to comment.