@@ -42,6 +42,7 @@ use rustc_hir as hir;
42
42
use rustc_hir:: def_id:: DefId ;
43
43
use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
44
44
use rustc_infer:: infer:: { Coercion , InferOk , InferResult } ;
45
+ use rustc_middle:: lint:: in_external_macro;
45
46
use rustc_middle:: ty:: adjustment:: {
46
47
Adjust , Adjustment , AllowTwoPhase , AutoBorrow , AutoBorrowMutability , PointerCast ,
47
48
} ;
@@ -1451,12 +1452,9 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
1451
1452
// If the block is from an external macro, then do not suggest
1452
1453
// adding a semicolon, because there's nowhere to put it.
1453
1454
// See issue #81943.
1454
- let hir = fcx. tcx . hir ( ) ;
1455
- let body_owner =
1456
- hir. body_owner ( hir. body_owned_by ( hir. enclosing_body_owner ( fcx. body_id ) ) ) ;
1457
- let from_same_crate = cond_expr. span . ctxt ( ) . dollar_crate_name ( )
1458
- == hir. span ( body_owner) . ctxt ( ) . dollar_crate_name ( ) ;
1459
- if cond_expr. span . desugaring_kind ( ) . is_none ( ) && from_same_crate {
1455
+ if cond_expr. span . desugaring_kind ( ) . is_none ( )
1456
+ && !in_external_macro ( fcx. tcx . sess , cond_expr. span )
1457
+ {
1460
1458
err. span_label ( cond_expr. span , "expected this to be `()`" ) ;
1461
1459
fcx. suggest_semicolon_at_end ( cond_expr. span , & mut err) ;
1462
1460
}
0 commit comments