aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-08-12 18:23:06 +0100
committerPhilip Herron <philip.herron@embecosm.com>2023-08-12 19:25:45 +0000
commit1d52917eb8ce49025d312e0c27ed53b8563f3dae (patch)
tree679e1bd651283b663ed4486954ef92a69419306c /gcc/rust
parent086b7f9c9ae653a5f847cbe2edd3c46874c62d20 (diff)
downloadgcc-1d52917eb8ce49025d312e0c27ed53b8563f3dae.zip
gcc-1d52917eb8ce49025d312e0c27ed53b8563f3dae.tar.gz
gcc-1d52917eb8ce49025d312e0c27ed53b8563f3dae.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/rust')
-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 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,