https://gcc.gnu.org/g:393153d9eff541d7d52d3fe99b8ac41cd78f89b1
commit r16-4828-g393153d9eff541d7d52d3fe99b8ac41cd78f89b1 Author: Philip Herron <[email protected]> Date: Mon Aug 25 20:44:16 2025 +0100 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 <[email protected]> Diff: --- gcc/rust/typecheck/rust-coercion.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/typecheck/rust-coercion.cc b/gcc/rust/typecheck/rust-coercion.cc index 2b023ed0edd2..e027d9c88c6c 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;
