Change:
I tried this code (): I expected to see this happen: A compiler error about missing between and Instead, this happened: This is very confusing, because I "know" that return type is which is coercible to anything else (or whatever is the technical explanation for "we can really ignore the return type of "), so it should not ever be present in error messages about mistyping stuff. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: This issue is also present in 1.34.2 (from a year ago), and in two-week-old nightly (rustc 1.45.0-nightly ( 2020-05-11)) p.s.: When deminimizing the issue, i realized that it's even more confusing when match is the last statement in a for loop (as it was in my real code), i.e.: gives the same error message about incompatible match arms.
The s coerces to because the whole needs to evaluate as a statement, not an expression because its return value is ignored. Adding a trailing "fixes" the code.
As far as I can tell, didn't fix this issue (you didn't add a test for it either), and the two UI tests that the PR did touch, the suggestion didn't do anything useful -- it only fires when one of the arms is actually evaluated to be type , rather than being constrained to due to (lack of) semicolon.
Actually, we do suggest using a semicolon, but not via . I'm just gonna revert that, and add this as a test.

Discussion:
prior_arm_ty, prior_arm_span, scrut_span: scrut.span, <ins> scrut_hir_id: scrut.hir_id, </ins> source: match_src, prior_arms: other_arms.clone(), opt_suggest_box_span,

ref prior_arms, opt_suggest_box_span, scrut_span, <ins> scrut_hir_id, </ins> .. }) => match source { hir::MatchSource::TryDesugar(scrut_hir_id) => {

) { err.subdiagnostic(subdiag); } <ins> if let Some(hir::Node::Expr(m)) = self.tcx.hir().find_parent(scrut_hir_id) && let Some(hir::Node::Stmt(stmt)) = self.tcx.hir().find_parent(m.hir_id) && let hir::StmtKind::Expr(_) = stmt.kind { err.span_suggestion_verbose( stmt.span.shrink_to_hi(), "consider using a semicolon here, but this will discard any values  in the match arms", ";", Applicability::MaybeIncorrect, ); } </ins> if let Some(ret_sp) = opt_suggest_box_span { // Get return type span and point to it. self.suggest_boxing_for_return_impl_trait(

pub prior_arm_ty: Ty<'tcx>, pub prior_arm_span: Span, pub scrut_span: Span, <ins> pub scrut_hir_id: hir::HirId, </ins> pub source: hir::MatchSource, pub prior_arms: Vec<Span>, pub opt_suggest_box_span: Option<Span>,

LL | /     match num { LL | |         1 => { LL | |             cx.answer_str("hi"); <del> | |             -------------------- | |             |                  | | |             |                  help: consider removing this semicolon | |             this is found to be of type `()` </del> <ins> | |             -------------------- this is found to be of type `()` </ins> LL | |         } LL | |         _ => cx.answer_str("hi"), | |              ^^^^^^^^^^^^^^^^^^^ expected `()`, found future LL | |     } | |_____- `match` arms have incompatible types <ins> | help: consider removing this semicolon | LL -             cx.answer_str("hi"); LL +             cx.answer_str("hi") | help: consider using a semicolon here, but this will discard any values in the match arms | LL |     }; |      + </ins> error: aborting due to previous error

| = note: expected reference `&S` found reference `&R` <ins> help: consider using a semicolon here, but this will discard any values in the match arms | LL |     }; |      + </ins> error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/wf-unsafe-trait-obj-match.rs:26:21