Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gcc/rust/typecheck/rust-type-util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
TyTy::TyWithLocation (receiver, rhs.get_locus ()), locus,
true /*emit_error*/, true /*commit*/, true /*infer*/,
true /*cleanup*/);
if (coerced->get_kind () == TyTy::TypeKind::ERROR)
{
delete coerced;
coerced = lhs.get_ty ();
}

context->insert_autoderef_mappings (id, std::move (result.adjustments));
return coerced;
}
Expand Down
Loading