@@ -41,15 +41,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
41
41
expr : & ' tcx hir:: Expr < ' tcx > ,
42
42
expected : Ty < ' tcx > ,
43
43
found : Ty < ' tcx > ,
44
- cause_span : Span ,
45
44
blk_id : hir:: HirId ,
46
45
) -> bool {
47
46
let expr = expr. peel_drop_temps ( ) ;
48
47
// If the expression is from an external macro, then do not suggest
49
48
// adding a semicolon, because there's nowhere to put it.
50
49
// 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) ;
53
52
}
54
53
let mut pointing_at_return_type = false ;
55
54
if let Some ( ( fn_decl, can_suggest) ) = self . get_fn_decl ( blk_id) {
@@ -388,7 +387,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
388
387
err : & mut DiagnosticBuilder < ' _ > ,
389
388
expression : & ' tcx hir:: Expr < ' tcx > ,
390
389
expected : Ty < ' tcx > ,
391
- cause_span : Span ,
392
390
) {
393
391
if expected. is_unit ( ) {
394
392
// `BlockTailExpression` only relevant if the tail expr would be
@@ -403,7 +401,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
403
401
if expression. can_have_side_effects ( ) =>
404
402
{
405
403
err. span_suggestion (
406
- cause_span . shrink_to_hi ( ) ,
404
+ expression . span . shrink_to_hi ( ) ,
407
405
"consider using a semicolon here" ,
408
406
";" . to_string ( ) ,
409
407
Applicability :: MachineApplicable ,
0 commit comments