@@ -41,15 +41,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4141 expr : & ' tcx hir:: Expr < ' tcx > ,
4242 expected : Ty < ' tcx > ,
4343 found : Ty < ' tcx > ,
44- cause_span : Span ,
4544 blk_id : hir:: HirId ,
4645 ) -> bool {
4746 let expr = expr. peel_drop_temps ( ) ;
4847 // If the expression is from an external macro, then do not suggest
4948 // adding a semicolon, because there's nowhere to put it.
5049 // See issue #81943.
51- if expr. can_have_side_effects ( ) && !in_external_macro ( self . tcx . sess , cause_span ) {
52- self . suggest_missing_semicolon ( err, expr, expected, cause_span ) ;
50+ if expr. can_have_side_effects ( ) && !in_external_macro ( self . tcx . sess , expr . span ) {
51+ self . suggest_missing_semicolon ( err, expr, expected) ;
5352 }
5453 let mut pointing_at_return_type = false ;
5554 if let Some ( ( fn_decl, can_suggest) ) = self . get_fn_decl ( blk_id) {
@@ -388,7 +387,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
388387 err : & mut DiagnosticBuilder < ' _ > ,
389388 expression : & ' tcx hir:: Expr < ' tcx > ,
390389 expected : Ty < ' tcx > ,
391- cause_span : Span ,
392390 ) {
393391 if expected. is_unit ( ) {
394392 // `BlockTailExpression` only relevant if the tail expr would be
@@ -403,7 +401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
403401 if expression. can_have_side_effects ( ) =>
404402 {
405403 err. span_suggestion (
406- cause_span . shrink_to_hi ( ) ,
404+ expression . span . shrink_to_hi ( ) ,
407405 "consider using a semicolon here" ,
408406 ";" . to_string ( ) ,
409407 Applicability :: MachineApplicable ,
0 commit comments