@@ -231,75 +231,71 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
231231 type T = stable_mir:: mir:: Statement ;
232232 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
233233 use rustc_middle:: mir:: StatementKind :: * ;
234+ let span = self . source_info . span . stable ( tables) ;
234235 match & self . kind {
235236 Assign ( assign) => Statement {
236237 kind : stable_mir:: mir:: StatementKind :: Assign (
237238 assign. 0 . stable ( tables) ,
238239 assign. 1 . stable ( tables) ,
239240 ) ,
240- span : self . source_info . span . stable ( tables ) ,
241+ span,
241242 } ,
242243 FakeRead ( fake_read_place) => Statement {
243244 kind : stable_mir:: mir:: StatementKind :: FakeRead (
244245 fake_read_place. 0 . stable ( tables) ,
245246 fake_read_place. 1 . stable ( tables) ,
246247 ) ,
247- span : self . source_info . span . stable ( tables ) ,
248+ span,
248249 } ,
249250 SetDiscriminant { place : plc, variant_index : idx } => Statement {
250251 kind : stable_mir:: mir:: StatementKind :: SetDiscriminant {
251252 place : plc. as_ref ( ) . stable ( tables) ,
252253 variant_index : idx. stable ( tables) ,
253254 } ,
254- span : self . source_info . span . stable ( tables ) ,
255+ span,
255256 } ,
256257 Deinit ( place) => Statement {
257258 kind : stable_mir:: mir:: StatementKind :: Deinit ( place. stable ( tables) ) ,
258- span : self . source_info . span . stable ( tables ) ,
259+ span,
259260 } ,
260261 StorageLive ( place) => Statement {
261262 kind : stable_mir:: mir:: StatementKind :: StorageLive ( place. stable ( tables) ) ,
262- span : self . source_info . span . stable ( tables ) ,
263+ span,
263264 } ,
264265 StorageDead ( place) => Statement {
265266 kind : stable_mir:: mir:: StatementKind :: StorageDead ( place. stable ( tables) ) ,
266- span : self . source_info . span . stable ( tables ) ,
267+ span,
267268 } ,
268269 Retag ( retag, place) => Statement {
269270 kind : stable_mir:: mir:: StatementKind :: Retag (
270271 retag. stable ( tables) ,
271272 place. stable ( tables) ,
272273 ) ,
273- span : self . source_info . span . stable ( tables ) ,
274+ span,
274275 } ,
275276 PlaceMention ( place) => Statement {
276277 kind : stable_mir:: mir:: StatementKind :: PlaceMention ( place. stable ( tables) ) ,
277- span : self . source_info . span . stable ( tables ) ,
278+ span,
278279 } ,
279280 AscribeUserType ( place_projection, variance) => Statement {
280281 kind : stable_mir:: mir:: StatementKind :: AscribeUserType {
281282 place : place_projection. as_ref ( ) . 0 . stable ( tables) ,
282283 projections : place_projection. as_ref ( ) . 1 . stable ( tables) ,
283284 variance : variance. stable ( tables) ,
284285 } ,
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,
290287 } ,
288+ Coverage ( coverage) => {
289+ Statement { kind : stable_mir:: mir:: StatementKind :: Coverage ( opaque ( coverage) ) , span }
290+ }
291291 Intrinsic ( intrinstic) => Statement {
292292 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,
302294 } ,
295+ ConstEvalCounter => {
296+ Statement { kind : stable_mir:: mir:: StatementKind :: ConstEvalCounter , span }
297+ }
298+ Nop => Statement { kind : stable_mir:: mir:: StatementKind :: Nop , span } ,
303299 }
304300 }
305301}
@@ -851,11 +847,11 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
851847 use rustc_middle:: mir:: TerminatorKind :: * ;
852848 use stable_mir:: mir:: Terminator ;
853849 use stable_mir:: mir:: TerminatorKind ;
850+ let span = self . source_info . span . stable ( tables) ;
854851 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+ }
859855 SwitchInt { discr, targets } => Terminator {
860856 kind : TerminatorKind :: SwitchInt {
861857 discr : discr. stable ( tables) ,
@@ -868,31 +864,19 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
868864 . collect ( ) ,
869865 otherwise : targets. otherwise ( ) . as_usize ( ) ,
870866 } ,
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,
888868 } ,
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 } ,
889873 Drop { place, target, unwind, replace : _ } => Terminator {
890874 kind : TerminatorKind :: Drop {
891875 place : place. stable ( tables) ,
892876 target : target. as_usize ( ) ,
893877 unwind : unwind. stable ( tables) ,
894878 } ,
895- span : self . source_info . span . stable ( tables ) ,
879+ span,
896880 } ,
897881 Call { func, args, destination, target, unwind, call_source : _, fn_span : _ } => {
898882 Terminator {
@@ -903,7 +887,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
903887 target : target. map ( |t| t. as_usize ( ) ) ,
904888 unwind : unwind. stable ( tables) ,
905889 } ,
906- span : self . source_info . span . stable ( tables ) ,
890+ span,
907891 }
908892 }
909893 Assert { cond, expected, msg, target, unwind } => Terminator {
@@ -914,7 +898,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
914898 target : target. as_usize ( ) ,
915899 unwind : unwind. stable ( tables) ,
916900 } ,
917- span : self . source_info . span . stable ( tables ) ,
901+ span,
918902 } ,
919903 InlineAsm { template, operands, options, line_spans, destination, unwind } => {
920904 Terminator {
@@ -926,7 +910,7 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
926910 destination : destination. map ( |d| d. as_usize ( ) ) ,
927911 unwind : unwind. stable ( tables) ,
928912 } ,
929- span : self . source_info . span . stable ( tables ) ,
913+ span,
930914 }
931915 }
932916 Yield { .. } | GeneratorDrop | FalseEdge { .. } | FalseUnwind { .. } => unreachable ! ( ) ,
0 commit comments