@@ -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) {
@@ -389,7 +388,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
389
388
err : & mut DiagnosticBuilder < ' _ > ,
390
389
expression : & ' tcx hir:: Expr < ' tcx > ,
391
390
expected : Ty < ' tcx > ,
392
- cause_span : Span ,
393
391
) {
394
392
if expected. is_unit ( ) {
395
393
// `BlockTailExpression` only relevant if the tail expr would be
@@ -404,7 +402,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
404
402
if expression. can_have_side_effects ( ) =>
405
403
{
406
404
err. span_suggestion (
407
- cause_span . shrink_to_hi ( ) ,
405
+ expression . span . shrink_to_hi ( ) ,
408
406
"consider using a semicolon here" ,
409
407
";" . to_string ( ) ,
410
408
Applicability :: MachineApplicable ,
0 commit comments