Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 0 additions & 6 deletions compiler/rustc_typeck/src/check/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/typeck/issue-87771-ice-assign-assign-to-bool.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
let mut a;
a = a = true; //~ ERROR mismatched types
}
Original file line number Diff line number Diff line change
@@ -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`.