@@ -124,8 +124,7 @@ struct ElaborateDropsCtxt<'a, 'tcx: 'a> {
124
124
125
125
#[ derive( Copy , Clone , Debug ) ]
126
126
struct DropCtxt < ' a , ' tcx : ' a > {
127
- span : Span ,
128
- scope : ScopeId ,
127
+ source_info : SourceInfo ,
129
128
is_cleanup : bool ,
130
129
131
130
init_data : & ' a InitializationData ,
@@ -273,8 +272,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
273
272
let init_data = self . initialization_data_at ( loc) ;
274
273
let path = self . move_data ( ) . rev_lookup . find ( location) ;
275
274
self . elaborate_drop ( & DropCtxt {
276
- span : terminator. span ,
277
- scope : terminator. scope ,
275
+ source_info : terminator. source_info ,
278
276
is_cleanup : data. is_cleanup ,
279
277
init_data : & init_data,
280
278
lvalue : location,
@@ -329,8 +327,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
329
327
330
328
let assign = Statement {
331
329
kind : StatementKind :: Assign ( location. clone ( ) , Rvalue :: Use ( value. clone ( ) ) ) ,
332
- span : terminator. span ,
333
- scope : terminator. scope
330
+ source_info : terminator. source_info
334
331
} ;
335
332
336
333
let unwind = unwind. unwrap_or ( self . patch . resume_block ( ) ) ;
@@ -367,8 +364,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
367
364
let path = self . move_data ( ) . rev_lookup . find ( location) ;
368
365
369
366
self . elaborate_drop ( & DropCtxt {
370
- span : terminator. span ,
371
- scope : terminator. scope ,
367
+ source_info : terminator. source_info ,
372
368
is_cleanup : data. is_cleanup ,
373
369
init_data : & init_data,
374
370
lvalue : location,
@@ -513,8 +509,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
513
509
debug ! ( "drop_ladder: for std field {} ({:?})" , i, lv) ;
514
510
515
511
self . elaborated_drop_block ( & DropCtxt {
516
- span : c. span ,
517
- scope : c. scope ,
512
+ source_info : c. source_info ,
518
513
is_cleanup : is_cleanup,
519
514
init_data : c. init_data ,
520
515
lvalue : lv,
@@ -527,8 +522,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
527
522
debug ! ( "drop_ladder: for rest field {} ({:?})" , i, lv) ;
528
523
529
524
let blk = self . complete_drop ( & DropCtxt {
530
- span : c. span ,
531
- scope : c. scope ,
525
+ source_info : c. source_info ,
532
526
is_cleanup : is_cleanup,
533
527
init_data : c. init_data ,
534
528
lvalue : lv,
@@ -785,7 +779,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
785
779
self . patch . new_block ( BasicBlockData {
786
780
statements : vec ! [ ] ,
787
781
terminator : Some ( Terminator {
788
- scope : c. scope , span : c . span , kind : k
782
+ source_info : c. source_info , kind : k
789
783
} ) ,
790
784
is_cleanup : is_cleanup
791
785
} )
@@ -858,11 +852,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
858
852
let mut statements = vec ! [ ] ;
859
853
if let Some ( & flag) = self . drop_flags . get ( & c. path ) {
860
854
statements. push ( Statement {
861
- span : c. span ,
862
- scope : c. scope ,
855
+ source_info : c. source_info ,
863
856
kind : StatementKind :: Assign (
864
857
Lvalue :: Temp ( flag) ,
865
- self . constant_bool ( c. span , false )
858
+ self . constant_bool ( c. source_info . span , false )
866
859
)
867
860
} ) ;
868
861
}
@@ -880,9 +873,9 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
880
873
self . patch . new_block ( BasicBlockData {
881
874
statements : statements,
882
875
terminator : Some ( Terminator {
883
- scope : c. scope , span : c . span , kind : TerminatorKind :: Call {
876
+ source_info : c. source_info , kind : TerminatorKind :: Call {
884
877
func : Operand :: Constant ( Constant {
885
- span : c. span ,
878
+ span : c. source_info . span ,
886
879
ty : fty,
887
880
literal : Literal :: Item {
888
881
def_id : free_func,
@@ -910,7 +903,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
910
903
ty:: TyStruct ( def, _) | ty:: TyEnum ( def, _) => {
911
904
if def. has_dtor ( ) {
912
905
self . tcx . sess . span_warn (
913
- c. span ,
906
+ c. source_info . span ,
914
907
& format ! ( "dataflow bug??? moving out of type with dtor {:?}" ,
915
908
c) ) ;
916
909
true
@@ -932,15 +925,15 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
932
925
933
926
fn set_drop_flag ( & mut self , loc : Location , path : MovePathIndex , val : DropFlagState ) {
934
927
if let Some ( & flag) = self . drop_flags . get ( & path) {
935
- let span = self . patch . context_for_location ( self . mir , loc) . 0 ;
928
+ let span = self . patch . source_info_for_location ( self . mir , loc) . span ;
936
929
let val = self . constant_bool ( span, val. value ( ) ) ;
937
930
self . patch . add_assign ( loc, Lvalue :: Temp ( flag) , val) ;
938
931
}
939
932
}
940
933
941
934
fn drop_flags_on_init ( & mut self ) {
942
935
let loc = Location { block : START_BLOCK , index : 0 } ;
943
- let span = self . patch . context_for_location ( self . mir , loc) . 0 ;
936
+ let span = self . patch . source_info_for_location ( self . mir , loc) . span ;
944
937
let false_ = self . constant_bool ( span, false ) ;
945
938
for flag in self . drop_flags . values ( ) {
946
939
self . patch . add_assign ( loc, Lvalue :: Temp ( * flag) , false_. clone ( ) ) ;
0 commit comments