@@ -231,75 +231,71 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
231
231
type T = stable_mir:: mir:: Statement ;
232
232
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
233
233
use rustc_middle:: mir:: StatementKind :: * ;
234
+ let span = self . source_info . span . stable ( tables) ;
234
235
match & self . kind {
235
236
Assign ( assign) => Statement {
236
237
kind : stable_mir:: mir:: StatementKind :: Assign (
237
238
assign. 0 . stable ( tables) ,
238
239
assign. 1 . stable ( tables) ,
239
240
) ,
240
- span : self . source_info . span . stable ( tables ) ,
241
+ span,
241
242
} ,
242
243
FakeRead ( fake_read_place) => Statement {
243
244
kind : stable_mir:: mir:: StatementKind :: FakeRead (
244
245
fake_read_place. 0 . stable ( tables) ,
245
246
fake_read_place. 1 . stable ( tables) ,
246
247
) ,
247
- span : self . source_info . span . stable ( tables ) ,
248
+ span,
248
249
} ,
249
250
SetDiscriminant { place : plc, variant_index : idx } => Statement {
250
251
kind : stable_mir:: mir:: StatementKind :: SetDiscriminant {
251
252
place : plc. as_ref ( ) . stable ( tables) ,
252
253
variant_index : idx. stable ( tables) ,
253
254
} ,
254
- span : self . source_info . span . stable ( tables ) ,
255
+ span,
255
256
} ,
256
257
Deinit ( place) => Statement {
257
258
kind : stable_mir:: mir:: StatementKind :: Deinit ( place. stable ( tables) ) ,
258
- span : self . source_info . span . stable ( tables ) ,
259
+ span,
259
260
} ,
260
261
StorageLive ( place) => Statement {
261
262
kind : stable_mir:: mir:: StatementKind :: StorageLive ( place. stable ( tables) ) ,
262
- span : self . source_info . span . stable ( tables ) ,
263
+ span,
263
264
} ,
264
265
StorageDead ( place) => Statement {
265
266
kind : stable_mir:: mir:: StatementKind :: StorageDead ( place. stable ( tables) ) ,
266
- span : self . source_info . span . stable ( tables ) ,
267
+ span,
267
268
} ,
268
269
Retag ( retag, place) => Statement {
269
270
kind : stable_mir:: mir:: StatementKind :: Retag (
270
271
retag. stable ( tables) ,
271
272
place. stable ( tables) ,
272
273
) ,
273
- span : self . source_info . span . stable ( tables ) ,
274
+ span,
274
275
} ,
275
276
PlaceMention ( place) => Statement {
276
277
kind : stable_mir:: mir:: StatementKind :: PlaceMention ( place. stable ( tables) ) ,
277
- span : self . source_info . span . stable ( tables ) ,
278
+ span,
278
279
} ,
279
280
AscribeUserType ( place_projection, variance) => Statement {
280
281
kind : stable_mir:: mir:: StatementKind :: AscribeUserType {
281
282
place : place_projection. as_ref ( ) . 0 . stable ( tables) ,
282
283
projections : place_projection. as_ref ( ) . 1 . stable ( tables) ,
283
284
variance : variance. stable ( tables) ,
284
285
} ,
285
- span : self . source_info . span . stable ( tables) ,
286
- } ,
287
- Coverage ( coverage) => Statement {
288
- kind : stable_mir:: mir:: StatementKind :: Coverage ( opaque ( coverage) ) ,
289
- span : self . source_info . span . stable ( tables) ,
286
+ span,
290
287
} ,
288
+ Coverage ( coverage) => {
289
+ Statement { kind : stable_mir:: mir:: StatementKind :: Coverage ( opaque ( coverage) ) , span }
290
+ }
291
291
Intrinsic ( intrinstic) => Statement {
292
292
kind : stable_mir:: mir:: StatementKind :: Intrinsic ( intrinstic. stable ( tables) ) ,
293
- span : self . source_info . span . stable ( tables) ,
294
- } ,
295
- ConstEvalCounter => Statement {
296
- kind : stable_mir:: mir:: StatementKind :: ConstEvalCounter ,
297
- span : self . source_info . span . stable ( tables) ,
298
- } ,
299
- Nop => Statement {
300
- kind : stable_mir:: mir:: StatementKind :: Nop ,
301
- span : self . source_info . span . stable ( tables) ,
293
+ span,
302
294
} ,
295
+ ConstEvalCounter => {
296
+ Statement { kind : stable_mir:: mir:: StatementKind :: ConstEvalCounter , span }
297
+ }
298
+ Nop => Statement { kind : stable_mir:: mir:: StatementKind :: Nop , span } ,
303
299
}
304
300
}
305
301
}
@@ -851,11 +847,11 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
851
847
use rustc_middle:: mir:: TerminatorKind :: * ;
852
848
use stable_mir:: mir:: Terminator ;
853
849
use stable_mir:: mir:: TerminatorKind ;
850
+ let span = self . source_info . span . stable ( tables) ;
854
851
match & self . kind {
855
- Goto { target } => Terminator {
856
- kind : TerminatorKind :: Goto { target : target. as_usize ( ) } ,
857
- span : self . source_info . span . stable ( tables) ,
858
- } ,
852
+ Goto { target } => {
853
+ Terminator { kind : TerminatorKind :: Goto { target : target. as_usize ( ) } , span }
854
+ }
859
855
SwitchInt { discr, targets } => Terminator {
860
856
kind : TerminatorKind :: SwitchInt {
861
857
discr : discr. stable ( tables) ,
@@ -868,31 +864,19 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
868
864
. collect ( ) ,
869
865
otherwise : targets. otherwise ( ) . as_usize ( ) ,
870
866
} ,
871
- span : self . source_info . span . stable ( tables) ,
872
- } ,
873
- UnwindResume => Terminator {
874
- kind : TerminatorKind :: Resume ,
875
- span : self . source_info . span . stable ( tables) ,
876
- } ,
877
- UnwindTerminate ( _) => Terminator {
878
- kind : TerminatorKind :: Abort ,
879
- span : self . source_info . span . stable ( tables) ,
880
- } ,
881
- Return => Terminator {
882
- kind : TerminatorKind :: Return ,
883
- span : self . source_info . span . stable ( tables) ,
884
- } ,
885
- Unreachable => Terminator {
886
- kind : TerminatorKind :: Unreachable ,
887
- span : self . source_info . span . stable ( tables) ,
867
+ span,
888
868
} ,
869
+ UnwindResume => Terminator { kind : TerminatorKind :: Resume , span } ,
870
+ UnwindTerminate ( _) => Terminator { kind : TerminatorKind :: Abort , span } ,
871
+ Return => Terminator { kind : TerminatorKind :: Return , span } ,
872
+ Unreachable => Terminator { kind : TerminatorKind :: Unreachable , span } ,
889
873
Drop { place, target, unwind, replace : _ } => Terminator {
890
874
kind : TerminatorKind :: Drop {
891
875
place : place. stable ( tables) ,
892
876
target : target. as_usize ( ) ,
893
877
unwind : unwind. stable ( tables) ,
894
878
} ,
895
- span : self . source_info . span . stable ( tables ) ,
879
+ span,
896
880
} ,
897
881
Call { func, args, destination, target, unwind, call_source : _, fn_span : _ } => {
898
882
Terminator {
@@ -903,7 +887,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
903
887
target : target. map ( |t| t. as_usize ( ) ) ,
904
888
unwind : unwind. stable ( tables) ,
905
889
} ,
906
- span : self . source_info . span . stable ( tables ) ,
890
+ span,
907
891
}
908
892
}
909
893
Assert { cond, expected, msg, target, unwind } => Terminator {
@@ -914,7 +898,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
914
898
target : target. as_usize ( ) ,
915
899
unwind : unwind. stable ( tables) ,
916
900
} ,
917
- span : self . source_info . span . stable ( tables ) ,
901
+ span,
918
902
} ,
919
903
InlineAsm { template, operands, options, line_spans, destination, unwind } => {
920
904
Terminator {
@@ -926,7 +910,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
926
910
destination : destination. map ( |d| d. as_usize ( ) ) ,
927
911
unwind : unwind. stable ( tables) ,
928
912
} ,
929
- span : self . source_info . span . stable ( tables ) ,
913
+ span,
930
914
}
931
915
}
932
916
Yield { .. } | GeneratorDrop | FalseEdge { .. } | FalseUnwind { .. } => unreachable ! ( ) ,
0 commit comments