@@ -457,35 +457,9 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfo<'tcx> {
457457 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
458458 stable_mir:: mir:: VarDebugInfo {
459459 name : self . name . to_string ( ) ,
460- source_info : stable_mir:: mir:: SourceInfo {
461- span : self . source_info . span . stable ( tables) ,
462- scope : self . source_info . scope . into ( ) ,
463- } ,
464- composite : {
465- if let Some ( composite) = & self . composite {
466- Some ( VarDebugInfoFragment {
467- ty : composite. ty . stable ( tables) ,
468- projection : composite. projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
469- } )
470- } else {
471- None
472- }
473- } ,
474- value : {
475- match self . value {
476- mir:: VarDebugInfoContents :: Place ( place) => {
477- stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
478- }
479- mir:: VarDebugInfoContents :: Const ( const_operand) => {
480- let op = ConstOperand {
481- span : const_operand. span . stable ( tables) ,
482- user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
483- const_ : const_operand. const_ . stable ( tables) ,
484- } ;
485- stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
486- }
487- }
488- } ,
460+ source_info : self . source_info . stable ( tables) ,
461+ composite : self . composite . as_ref ( ) . map ( |composite| composite. stable ( tables) ) ,
462+ value : self . value . stable ( tables) ,
489463 argument_index : self . argument_index ,
490464 }
491465 }
@@ -498,6 +472,42 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
498472 }
499473}
500474
475+ impl < ' tcx > Stable < ' tcx > for mir:: SourceInfo {
476+ type T = stable_mir:: mir:: SourceInfo ;
477+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
478+ stable_mir:: mir:: SourceInfo { span : self . span . stable ( tables) , scope : self . scope . into ( ) }
479+ }
480+ }
481+
482+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoFragment < ' tcx > {
483+ type T = stable_mir:: mir:: VarDebugInfoFragment ;
484+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
485+ VarDebugInfoFragment {
486+ ty : self . ty . stable ( tables) ,
487+ projection : self . projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
488+ }
489+ }
490+ }
491+
492+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoContents < ' tcx > {
493+ type T = stable_mir:: mir:: VarDebugInfoContents ;
494+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
495+ match self {
496+ mir:: VarDebugInfoContents :: Place ( place) => {
497+ stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
498+ }
499+ mir:: VarDebugInfoContents :: Const ( const_operand) => {
500+ let op = ConstOperand {
501+ span : const_operand. span . stable ( tables) ,
502+ user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
503+ const_ : const_operand. const_ . stable ( tables) ,
504+ } ;
505+ stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
506+ }
507+ }
508+ }
509+ }
510+
501511impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
502512 type T = stable_mir:: mir:: StatementKind ;
503513 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments