Don't emit coerce suggestions for a type into itself

This commit is contained in:
Michael Goulet 2022-11-10 20:21:13 +00:00
parent a3c0a02361
commit 312d6b8e9a

View file

@ -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