From: Philip Herron Date: Mon, 25 Aug 2025 19:44:16 +0000 (+0100) Subject: gccrs: Make the coerce borrowed pointer consistent with try flag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=393153d9eff541d7d52d3fe99b8ac41cd78f89b1;p=thirdparty%2Fgcc.git gccrs: Make the coerce borrowed pointer consistent with try flag This interface is not respecting the coercion api commit is always false, we need to ensure this is respected via the try flag like the rest of the coercion logic. gcc/rust/ChangeLog: * typecheck/rust-coercion.cc (TypeCoercionRules::select): respect try flag Signed-off-by: Philip Herron --- diff --git a/gcc/rust/typecheck/rust-coercion.cc b/gcc/rust/typecheck/rust-coercion.cc index 2b023ed0edd..e027d9c88c6 100644 --- a/gcc/rust/typecheck/rust-coercion.cc +++ b/gcc/rust/typecheck/rust-coercion.cc @@ -439,7 +439,8 @@ TypeCoercionRules::select (TyTy::BaseType &autoderefed) = unify_site_and (autoderefed.get_ref (), TyTy::TyWithLocation (expected), TyTy::TyWithLocation (&autoderefed), UNDEF_LOCATION /* locus */, false /*emit_errors*/, - false /*commit_if_ok*/, true /*infer*/, true /*cleanup*/); + !try_flag /*commit_if_ok*/, try_flag /*infer*/, + try_flag /*cleanup*/); bool ok = result->get_kind () != TyTy::TypeKind::ERROR; if (!ok) return false;