aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-08-12 18:23:06 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:00:30 +0100
commit4459962a83ff5c5b6f3d9f76cb8b6c7a71d300c0 (patch)
tree76644ef867edb454dd083bd7882ce28c5b8ad8dd /gcc
parentaef47d79660c81dedaa3655437e7c6653d00f358 (diff)
downloadgcc-4459962a83ff5c5b6f3d9f76cb8b6c7a71d300c0.zip
gcc-4459962a83ff5c5b6f3d9f76cb8b6c7a71d300c0.tar.gz
gcc-4459962a83ff5c5b6f3d9f76cb8b6c7a71d300c0.tar.bz2
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 <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index 91e7d67..5a0d9a1 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,