@@ -1854,25 +1854,24 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
1854
1854
fcx. err_ctxt ( ) . report_mismatched_types ( cause, fcx. param_env , expected, found, ty_err) ;
1855
1855
1856
1856
let due_to_block = matches ! ( fcx. tcx. hir_node( block_or_return_id) , hir:: Node :: Block ( ..) ) ;
1857
-
1858
- let parent_id = fcx. tcx . parent_hir_id ( block_or_return_id) ;
1859
- let parent = fcx. tcx . hir_node ( parent_id) ;
1857
+ let parent = fcx. tcx . parent_hir_node ( block_or_return_id) ;
1860
1858
if let Some ( expr) = expression
1861
1859
&& let hir:: Node :: Expr ( & hir:: Expr {
1862
1860
kind : hir:: ExprKind :: Closure ( & hir:: Closure { body, .. } ) ,
1863
1861
..
1864
1862
} ) = parent
1865
- && !matches ! ( fcx. tcx. hir_body( body) . value. kind, hir:: ExprKind :: Block ( ..) )
1866
1863
{
1867
- fcx. suggest_missing_semicolon ( & mut err, expr, expected, true ) ;
1864
+ let needs_block =
1865
+ !matches ! ( fcx. tcx. hir_body( body) . value. kind, hir:: ExprKind :: Block ( ..) ) ;
1866
+ fcx. suggest_missing_semicolon ( & mut err, expr, expected, needs_block, true ) ;
1868
1867
}
1869
1868
// Verify that this is a tail expression of a function, otherwise the
1870
1869
// label pointing out the cause for the type coercion will be wrong
1871
1870
// as prior return coercions would not be relevant (#57664).
1872
1871
if let Some ( expr) = expression
1873
1872
&& due_to_block
1874
1873
{
1875
- fcx. suggest_missing_semicolon ( & mut err, expr, expected, false ) ;
1874
+ fcx. suggest_missing_semicolon ( & mut err, expr, expected, false , false ) ;
1876
1875
let pointing_at_return_type = fcx. suggest_mismatched_types_on_tail (
1877
1876
& mut err,
1878
1877
expr,
0 commit comments