parent
cdddcd3bea
commit
a53f280bfc
5 changed files with 30 additions and 4 deletions
|
@ -775,6 +775,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
ref prior_arms,
|
||||
opt_suggest_box_span,
|
||||
scrut_span,
|
||||
scrut_hir_id,
|
||||
..
|
||||
}) => match source {
|
||||
hir::MatchSource::TryDesugar(scrut_hir_id) => {
|
||||
|
@ -842,6 +843,18 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
) {
|
||||
err.subdiagnostic(subdiag);
|
||||
}
|
||||
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,
|
||||
);
|
||||
}
|
||||
if let Some(ret_sp) = opt_suggest_box_span {
|
||||
// Get return type span and point to it.
|
||||
self.suggest_boxing_for_return_impl_trait(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue