@@ -18,7 +18,10 @@ use rustc_middle::ty::{self, Instance, ParamEnv, ScalarInt, Ty, TyCtxt, Variance
18
18
use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
19
19
use rustc_target:: abi:: FieldIdx ;
20
20
use 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
+ } ;
22
25
use stable_mir:: ty:: {
23
26
AdtDef , AdtKind , ClosureDef , ClosureKind , Const , ConstId , ConstantKind , EarlyParamRegion ,
24
27
FloatTy , FnDef , GenericArgs , GenericParamDef , IntTy , LineInfo , Movability , RigidTy , Span ,
@@ -444,17 +447,67 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
444
447
} )
445
448
. collect ( ) ,
446
449
self . arg_count ,
450
+ self . var_debug_info . iter ( ) . map ( |info| info. stable ( tables) ) . collect ( ) ,
447
451
)
448
452
}
449
453
}
450
454
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
+
451
468
impl < ' tcx > Stable < ' tcx > for mir:: Statement < ' tcx > {
452
469
type T = stable_mir:: mir:: Statement ;
453
470
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
454
471
Statement { kind : self . kind . stable ( tables) , span : self . source_info . span . stable ( tables) }
455
472
}
456
473
}
457
474
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
+
458
511
impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
459
512
type T = stable_mir:: mir:: StatementKind ;
460
513
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments