@@ -815,52 +815,83 @@ impl<'tcx> Stable<'tcx> for mir::Terminator<'tcx> {
815
815
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
816
816
use rustc_middle:: mir:: TerminatorKind :: * ;
817
817
use stable_mir:: mir:: Terminator ;
818
+ use stable_mir:: mir:: TerminatorKind ;
818
819
match & self . kind {
819
- Goto { target } => Terminator :: Goto { target : target. as_usize ( ) } ,
820
- SwitchInt { discr, targets } => Terminator :: SwitchInt {
821
- discr : discr. stable ( tables) ,
822
- targets : targets
823
- . iter ( )
824
- . map ( |( value, target) | stable_mir:: mir:: SwitchTarget {
825
- value,
826
- target : target. as_usize ( ) ,
827
- } )
828
- . collect ( ) ,
829
- otherwise : targets. otherwise ( ) . as_usize ( ) ,
820
+ Goto { target } => Terminator {
821
+ kind : TerminatorKind :: Goto { target : target. as_usize ( ) } ,
822
+ span : self . source_info . span . stable ( tables) ,
830
823
} ,
831
- UnwindResume => Terminator :: Resume ,
832
- UnwindTerminate ( _) => Terminator :: Abort ,
833
- Return => Terminator :: Return ,
834
- Unreachable => Terminator :: Unreachable ,
835
- Drop { place, target, unwind, replace : _ } => Terminator :: Drop {
836
- place : place. stable ( tables) ,
837
- target : target. as_usize ( ) ,
838
- unwind : unwind. stable ( tables) ,
824
+ SwitchInt { discr, targets } => Terminator {
825
+ kind : TerminatorKind :: SwitchInt {
826
+ discr : discr. stable ( tables) ,
827
+ targets : targets
828
+ . iter ( )
829
+ . map ( |( value, target) | stable_mir:: mir:: SwitchTarget {
830
+ value,
831
+ target : target. as_usize ( ) ,
832
+ } )
833
+ . collect ( ) ,
834
+ otherwise : targets. otherwise ( ) . as_usize ( ) ,
835
+ } ,
836
+ span : self . source_info . span . stable ( tables) ,
839
837
} ,
840
- Call { func, args, destination, target, unwind, call_source : _, fn_span : _ } => {
841
- Terminator :: Call {
842
- func : func. stable ( tables) ,
843
- args : args. iter ( ) . map ( |arg| arg. stable ( tables) ) . collect ( ) ,
844
- destination : destination. stable ( tables) ,
845
- target : target. map ( |t| t. as_usize ( ) ) ,
838
+ UnwindResume => Terminator {
839
+ kind : TerminatorKind :: Resume ,
840
+ span : self . source_info . span . stable ( tables) ,
841
+ } ,
842
+ UnwindTerminate ( _) => Terminator {
843
+ kind : TerminatorKind :: Abort ,
844
+ span : self . source_info . span . stable ( tables) ,
845
+ } ,
846
+ Return => Terminator {
847
+ kind : TerminatorKind :: Return ,
848
+ span : self . source_info . span . stable ( tables) ,
849
+ } ,
850
+ Unreachable => Terminator {
851
+ kind : TerminatorKind :: Unreachable ,
852
+ span : self . source_info . span . stable ( tables) ,
853
+ } ,
854
+ Drop { place, target, unwind, replace : _ } => Terminator {
855
+ kind : TerminatorKind :: Drop {
856
+ place : place. stable ( tables) ,
857
+ target : target. as_usize ( ) ,
846
858
unwind : unwind. stable ( tables) ,
859
+ } ,
860
+ span : self . source_info . span . stable ( tables) ,
861
+ } ,
862
+ Call { func, args, destination, target, unwind, call_source : _, fn_span : _ } => {
863
+ Terminator {
864
+ kind : TerminatorKind :: Call {
865
+ func : func. stable ( tables) ,
866
+ args : args. iter ( ) . map ( |arg| arg. stable ( tables) ) . collect ( ) ,
867
+ destination : destination. stable ( tables) ,
868
+ target : target. map ( |t| t. as_usize ( ) ) ,
869
+ unwind : unwind. stable ( tables) ,
870
+ } ,
871
+ span : self . source_info . span . stable ( tables) ,
847
872
}
848
873
}
849
- Assert { cond, expected, msg, target, unwind } => Terminator :: Assert {
850
- cond : cond. stable ( tables) ,
851
- expected : * expected,
852
- msg : msg. stable ( tables) ,
853
- target : target. as_usize ( ) ,
854
- unwind : unwind. stable ( tables) ,
874
+ Assert { cond, expected, msg, target, unwind } => Terminator {
875
+ kind : TerminatorKind :: Assert {
876
+ cond : cond. stable ( tables) ,
877
+ expected : * expected,
878
+ msg : msg. stable ( tables) ,
879
+ target : target. as_usize ( ) ,
880
+ unwind : unwind. stable ( tables) ,
881
+ } ,
882
+ span : self . source_info . span . stable ( tables) ,
855
883
} ,
856
884
InlineAsm { template, operands, options, line_spans, destination, unwind } => {
857
- Terminator :: InlineAsm {
858
- template : format ! ( "{template:?}" ) ,
859
- operands : operands. iter ( ) . map ( |operand| operand. stable ( tables) ) . collect ( ) ,
860
- options : format ! ( "{options:?}" ) ,
861
- line_spans : format ! ( "{line_spans:?}" ) ,
862
- destination : destination. map ( |d| d. as_usize ( ) ) ,
863
- unwind : unwind. stable ( tables) ,
885
+ Terminator {
886
+ kind : TerminatorKind :: InlineAsm {
887
+ template : format ! ( "{template:?}" ) ,
888
+ operands : operands. iter ( ) . map ( |operand| operand. stable ( tables) ) . collect ( ) ,
889
+ options : format ! ( "{options:?}" ) ,
890
+ line_spans : format ! ( "{line_spans:?}" ) ,
891
+ destination : destination. map ( |d| d. as_usize ( ) ) ,
892
+ unwind : unwind. stable ( tables) ,
893
+ } ,
894
+ span : self . source_info . span . stable ( tables) ,
864
895
}
865
896
}
866
897
Yield { .. } | GeneratorDrop | FalseEdge { .. } | FalseUnwind { .. } => unreachable ! ( ) ,
0 commit comments