Skip to content

Commit dec7fc3

Browse files
theo-lwtlwang
authored and
tlwang
committed
Fix an ICE caused by type mismatch errors being ignored
1 parent 5eacec9 commit dec7fc3

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

compiler/rustc_typeck/src/check/demand.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
145145
let expr_ty = self.resolve_vars_with_obligations(checked_ty);
146146
let mut err = self.report_mismatched_types(&cause, expected, expr_ty, e);
147147

148-
if self.is_assign_to_bool(expr, expected) {
149-
// Error reported in `check_assign` so avoid emitting error again.
150-
err.delay_as_bug();
151-
return (expected, None);
152-
}
153-
154148
self.emit_coerce_suggestions(&mut err, expr, expr_ty, expected, expected_ty_expr);
155149

156150
(expected, Some(err))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
let mut a;
3+
a = a = true; //~ ERROR mismatched types
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-87771-ice-assign-assign-to-bool.rs:3:9
3+
|
4+
LL | a = a = true;
5+
| ^^^^^^^^ expected `bool`, found `()`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)