Skip to content

Commit 299c5a0

Browse files
committed
Give right hand type higher priority on errors
gcc/rust/ChangeLog: * typecheck/rust-unify.cc (UnifyRules::Resolve): Return right hand type on error. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent 522d2d3 commit 299c5a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gcc/rust/typecheck/rust-unify.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ UnifyRules::Resolve (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
5050

5151
bool failed = result->get_kind () == TyTy::TypeKind::ERROR;
5252
if (failed && r.emit_error)
53-
r.emit_type_mismatch ();
53+
{
54+
r.emit_type_mismatch ();
55+
return lhs.get_ty ()->clone ();
56+
}
5457

5558
return result;
5659
}

0 commit comments

Comments
 (0)