@@ -425,35 +425,9 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfo<'tcx> {
425
425
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
426
426
stable_mir:: mir:: VarDebugInfo {
427
427
name : self . name . to_string ( ) ,
428
- source_info : stable_mir:: mir:: SourceInfo {
429
- span : self . source_info . span . stable ( tables) ,
430
- scope : self . source_info . scope . into ( ) ,
431
- } ,
432
- composite : {
433
- if let Some ( composite) = & self . composite {
434
- Some ( VarDebugInfoFragment {
435
- ty : composite. ty . stable ( tables) ,
436
- projection : composite. projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
437
- } )
438
- } else {
439
- None
440
- }
441
- } ,
442
- value : {
443
- match self . value {
444
- mir:: VarDebugInfoContents :: Place ( place) => {
445
- stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
446
- }
447
- mir:: VarDebugInfoContents :: Const ( const_operand) => {
448
- let op = ConstOperand {
449
- span : const_operand. span . stable ( tables) ,
450
- user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
451
- const_ : const_operand. const_ . stable ( tables) ,
452
- } ;
453
- stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
454
- }
455
- }
456
- } ,
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) ,
457
431
argument_index : self . argument_index ,
458
432
}
459
433
}
@@ -466,6 +440,42 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
466
440
}
467
441
}
468
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
+
469
479
impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
470
480
type T = stable_mir:: mir:: StatementKind ;
471
481
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments