@@ -18,7 +18,10 @@ use rustc_middle::ty::{self, Instance, ParamEnv, ScalarInt, Ty, TyCtxt, Variance
1818use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
1919use rustc_target:: abi:: FieldIdx ;
2020use stable_mir:: mir:: mono:: InstanceDef ;
21- use stable_mir:: mir:: { Body , CopyNonOverlapping , Statement , UserTypeProjection , VariantIdx } ;
21+ use stable_mir:: mir:: {
22+ Body , ConstOperand , CopyNonOverlapping , Statement , UserTypeProjection , VarDebugInfoFragment ,
23+ VariantIdx ,
24+ } ;
2225use stable_mir:: ty:: {
2326 AdtDef , AdtKind , ClosureDef , ClosureKind , Const , ConstId , ConstantKind , EarlyParamRegion ,
2427 FloatTy , FnDef , GenericArgs , GenericParamDef , IntTy , LineInfo , Movability , RigidTy , Span ,
@@ -444,17 +447,67 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
444447 } )
445448 . collect ( ) ,
446449 self . arg_count ,
450+ self . var_debug_info . iter ( ) . map ( |info| info. stable ( tables) ) . collect ( ) ,
447451 )
448452 }
449453}
450454
455+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfo < ' tcx > {
456+ type T = stable_mir:: mir:: VarDebugInfo ;
457+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
458+ stable_mir:: mir:: VarDebugInfo {
459+ name : self . name . to_string ( ) ,
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) ,
463+ argument_index : self . argument_index ,
464+ }
465+ }
466+ }
467+
451468impl < ' tcx > Stable < ' tcx > for mir:: Statement < ' tcx > {
452469 type T = stable_mir:: mir:: Statement ;
453470 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
454471 Statement { kind : self . kind . stable ( tables) , span : self . source_info . span . stable ( tables) }
455472 }
456473}
457474
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+
458511impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
459512 type T = stable_mir:: mir:: StatementKind ;
460513 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments