aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-03-17 18:09:42 +0000
committerPhilip Herron <philip.herron@embecosm.com>2023-03-18 00:15:08 +0000
commit858fd17fcf9aeddd9392d480c19471aaac891e5f (patch)
treef6fa7fd73628148097a272d714db95d8b092e710 /gcc
parent5751556c9e6dc012ade461c04624ef9c39d1d6cf (diff)
downloadgcc-858fd17fcf9aeddd9392d480c19471aaac891e5f.zip
gcc-858fd17fcf9aeddd9392d480c19471aaac891e5f.tar.gz
gcc-858fd17fcf9aeddd9392d480c19471aaac891e5f.tar.bz2
gccrs: Fix bad method resolution
We should use the result of our attempted unify inference as this will allow the direct unification of generic pointer types to concrete ones. Fixes #1981 gcc/rust/ChangeLog: * typecheck/rust-coercion.cc (TypeCoercionRules::select): use the result Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-coercion.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/rust/typecheck/rust-coercion.cc b/gcc/rust/typecheck/rust-coercion.cc
index 7b91edf..4eb3746 100644
--- a/gcc/rust/typecheck/rust-coercion.cc
+++ b/gcc/rust/typecheck/rust-coercion.cc
@@ -413,9 +413,9 @@ TypeCoercionRules::coerce_unsized (TyTy::BaseType *source,
bool
TypeCoercionRules::select (TyTy::BaseType &autoderefed)
{
- rust_debug (
- "autoderef type-coercion select autoderefed={%s} can_eq expected={%s}",
- autoderefed.debug_str ().c_str (), expected->debug_str ().c_str ());
+ rust_debug ("TypeCoercionRules::select autoderefed={%s} can_eq expected={%s}",
+ autoderefed.debug_str ().c_str (),
+ expected->debug_str ().c_str ());
TyTy::BaseType *result
= unify_site_and (autoderefed.get_ref (), TyTy::TyWithLocation (expected),
@@ -426,7 +426,7 @@ TypeCoercionRules::select (TyTy::BaseType &autoderefed)
if (!ok)
return false;
- try_result = CoercionResult{adjustments, autoderefed.clone ()};
+ try_result = CoercionResult{adjustments, result};
return true;
}