From: Philip Herron Date: Fri, 17 Mar 2023 18:09:42 +0000 (+0000) Subject: gccrs: Fix bad method resolution X-Git-Tag: basepoints/gcc-15~2758 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d169ce149a3af1d50ea36345a4e26805535a989;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/rust/typecheck/rust-coercion.cc b/gcc/rust/typecheck/rust-coercion.cc index b5d6cef2f79d..2cc719675111 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; }