@@ -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) {
@@ -389,7 +388,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
389388 err : & mut DiagnosticBuilder < ' _ > ,
390389 expression : & ' tcx hir:: Expr < ' tcx > ,
391390 expected : Ty < ' tcx > ,
392- cause_span : Span ,
393391 ) {
394392 if expected. is_unit ( ) {
395393 // `BlockTailExpression` only relevant if the tail expr would be
@@ -404,7 +402,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
404402 if expression. can_have_side_effects ( ) =>
405403 {
406404 err. span_suggestion (
407- cause_span . shrink_to_hi ( ) ,
405+ expression . span . shrink_to_hi ( ) ,
408406 "consider using a semicolon here" ,
409407 ";" . to_string ( ) ,
410408 Applicability :: MachineApplicable ,
0 commit comments