@@ -18,7 +18,10 @@ use rustc_middle::ty::{self, Instance, ParamEnv, 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 ,
@@ -412,17 +415,67 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
412415 } )
413416 . collect ( ) ,
414417 self . arg_count ,
418+ self . var_debug_info . iter ( ) . map ( |info| info. stable ( tables) ) . collect ( ) ,
415419 )
416420 }
417421}
418422
423+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfo < ' tcx > {
424+ type T = stable_mir:: mir:: VarDebugInfo ;
425+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
426+ stable_mir:: mir:: VarDebugInfo {
427+ name : self . name . to_string ( ) ,
428+ source_info : self . source_info . stable ( tables) ,
429+ composite : self . composite . as_ref ( ) . map ( |composite| composite. stable ( tables) ) ,
430+ value : self . value . stable ( tables) ,
431+ argument_index : self . argument_index ,
432+ }
433+ }
434+ }
435+
419436impl < ' tcx > Stable < ' tcx > for mir:: Statement < ' tcx > {
420437 type T = stable_mir:: mir:: Statement ;
421438 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
422439 Statement { kind : self . kind . stable ( tables) , span : self . source_info . span . stable ( tables) }
423440 }
424441}
425442
443+ impl < ' tcx > Stable < ' tcx > for mir:: SourceInfo {
444+ type T = stable_mir:: mir:: SourceInfo ;
445+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
446+ stable_mir:: mir:: SourceInfo { span : self . span . stable ( tables) , scope : self . scope . into ( ) }
447+ }
448+ }
449+
450+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoFragment < ' tcx > {
451+ type T = stable_mir:: mir:: VarDebugInfoFragment ;
452+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
453+ VarDebugInfoFragment {
454+ ty : self . ty . stable ( tables) ,
455+ projection : self . projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
456+ }
457+ }
458+ }
459+
460+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoContents < ' tcx > {
461+ type T = stable_mir:: mir:: VarDebugInfoContents ;
462+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
463+ match self {
464+ mir:: VarDebugInfoContents :: Place ( place) => {
465+ stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
466+ }
467+ mir:: VarDebugInfoContents :: Const ( const_operand) => {
468+ let op = ConstOperand {
469+ span : const_operand. span . stable ( tables) ,
470+ user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
471+ const_ : const_operand. const_ . stable ( tables) ,
472+ } ;
473+ stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
474+ }
475+ }
476+ }
477+ }
478+
426479impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
427480 type T = stable_mir:: mir:: StatementKind ;
428481 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments