@@ -10,7 +10,7 @@ use rustc_middle::mir::*;
10
10
use rustc_middle:: traits:: ObligationCause ;
11
11
use rustc_middle:: ty:: subst:: Subst ;
12
12
use rustc_middle:: ty:: { self , ConstKind , Instance , InstanceDef , ParamEnv , Ty , TyCtxt } ;
13
- use rustc_span:: { hygiene:: ExpnKind , ExpnData , Span } ;
13
+ use rustc_span:: { hygiene:: ExpnKind , ExpnData , LocalExpnId , Span } ;
14
14
use rustc_target:: spec:: abi:: Abi ;
15
15
16
16
use super :: simplify:: { remove_dead_blocks, CfgSimplifier } ;
@@ -543,6 +543,16 @@ impl<'tcx> Inliner<'tcx> {
543
543
// Copy the arguments if needed.
544
544
let args: Vec < _ > = self . make_call_args ( args, & callsite, caller_body, & callee_body) ;
545
545
546
+ let mut expn_data = ExpnData :: default (
547
+ ExpnKind :: Inlined ,
548
+ callsite. source_info . span ,
549
+ self . tcx . sess . edition ( ) ,
550
+ None ,
551
+ None ,
552
+ ) ;
553
+ expn_data. def_site = callee_body. span ;
554
+ let expn_data =
555
+ LocalExpnId :: fresh ( expn_data, self . tcx . create_stable_hashing_context ( ) ) ;
546
556
let mut integrator = Integrator {
547
557
args : & args,
548
558
new_locals : Local :: new ( caller_body. local_decls . len ( ) ) ..,
@@ -553,8 +563,7 @@ impl<'tcx> Inliner<'tcx> {
553
563
cleanup_block : cleanup,
554
564
in_cleanup_block : false ,
555
565
tcx : self . tcx ,
556
- callsite_span : callsite. source_info . span ,
557
- body_span : callee_body. span ,
566
+ expn_data,
558
567
always_live_locals : BitSet :: new_filled ( callee_body. local_decls . len ( ) ) ,
559
568
} ;
560
569
@@ -787,8 +796,7 @@ struct Integrator<'a, 'tcx> {
787
796
cleanup_block : Option < BasicBlock > ,
788
797
in_cleanup_block : bool ,
789
798
tcx : TyCtxt < ' tcx > ,
790
- callsite_span : Span ,
791
- body_span : Span ,
799
+ expn_data : LocalExpnId ,
792
800
always_live_locals : BitSet < Local > ,
793
801
}
794
802
@@ -835,12 +843,8 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
835
843
}
836
844
837
845
fn visit_span ( & mut self , span : & mut Span ) {
838
- let mut expn_data =
839
- ExpnData :: default ( ExpnKind :: Inlined , * span, self . tcx . sess . edition ( ) , None , None ) ;
840
- expn_data. def_site = self . body_span ;
841
846
// Make sure that all spans track the fact that they were inlined.
842
- * span =
843
- self . callsite_span . fresh_expansion ( expn_data, self . tcx . create_stable_hashing_context ( ) ) ;
847
+ * span = span. fresh_expansion ( self . expn_data ) ;
844
848
}
845
849
846
850
fn visit_place ( & mut self , place : & mut Place < ' tcx > , context : PlaceContext , location : Location ) {
0 commit comments