Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 312d6b8

Browse files
Don't emit coerce suggestions for a type into itself
1 parent a3c0a02 commit 312d6b8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3030
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
3131
error: Option<TypeError<'tcx>>,
3232
) {
33+
if expr_ty == expected {
34+
return;
35+
}
36+
3337
self.annotate_expected_due_to_let_ty(err, expr, error);
3438

3539
// Use `||` to give these suggestions a precedence

0 commit comments

Comments
 (0)