From 858fd17fcf9aeddd9392d480c19471aaac891e5f Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 17 Mar 2023 18:09:42 +0000 Subject: 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 --- gcc/rust/typecheck/rust-coercion.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc') 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; } -- cgit v1.1