From 1d52917eb8ce49025d312e0c27ed53b8563f3dae Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Sat, 12 Aug 2023 18:23:06 +0100 Subject: 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 --- gcc/rust/backend/rust-compile-base.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/rust/backend') diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index 499b9ac..c2ac15d 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, -- cgit v1.1