Skip to content

Commit

Permalink
Don't emit coerce suggestions for a type into itself
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Nov 10, 2022
1 parent a3c0a02 commit 312d6b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_hir_typeck/src/demand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
error: Option<TypeError<'tcx>>,
) {
if expr_ty == expected {
return;
}

self.annotate_expected_due_to_let_ty(err, expr, error);

// Use `||` to give these suggestions a precedence
Expand Down

0 comments on commit 312d6b8

Please sign in to comment.