From: Philip Herron <[email protected]>
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]>
---
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 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;
--
2.50.1