Fix an ICE caused by type mismatch errors being ignored

This commit is contained in:
Theodore Luo Wang 2021-08-28 21:18:20 -04:00 committed by tlwang
parent 5eacec9ec7
commit dec7fc3ced
3 changed files with 13 additions and 6 deletions

View file

@ -145,12 +145,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let expr_ty = self.resolve_vars_with_obligations(checked_ty);
let mut err = self.report_mismatched_types(&cause, expected, expr_ty, e);
if self.is_assign_to_bool(expr, expected) {
// Error reported in `check_assign` so avoid emitting error again.
err.delay_as_bug();
return (expected, None);
}
self.emit_coerce_suggestions(&mut err, expr, expr_ty, expected, expected_ty_expr);
(expected, Some(err))