@@ -18,7 +18,10 @@ use rustc_middle::ty::{self, Instance, ParamEnv, 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 ,
@@ -412,17 +415,67 @@ impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
412
415
} )
413
416
. collect ( ) ,
414
417
self . arg_count ,
418
+ self . var_debug_info . iter ( ) . map ( |info| info. stable ( tables) ) . collect ( ) ,
415
419
)
416
420
}
417
421
}
418
422
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
+
419
436
impl < ' tcx > Stable < ' tcx > for mir:: Statement < ' tcx > {
420
437
type T = stable_mir:: mir:: Statement ;
421
438
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
422
439
Statement { kind : self . kind . stable ( tables) , span : self . source_info . span . stable ( tables) }
423
440
}
424
441
}
425
442
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
+
426
479
impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
427
480
type T = stable_mir:: mir:: StatementKind ;
428
481
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments