Fix an ICE caused by type mismatch errors being ignored
This commit is contained in:
parent
5eacec9ec7
commit
dec7fc3ced
3 changed files with 13 additions and 6 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
fn main() {
|
||||
let mut a;
|
||||
a = a = true; //~ ERROR mismatched types
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-87771-ice-assign-assign-to-bool.rs:3:9
|
||||
|
|
||||
LL | a = a = true;
|
||||
| ^^^^^^^^ expected `bool`, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue