@@ -326,35 +326,9 @@ impl<'tcx> Stable<'tcx> for mir::VarDebugInfo<'tcx> {
326
326
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
327
327
stable_mir:: mir:: VarDebugInfo {
328
328
name : self . name . to_string ( ) ,
329
- source_info : stable_mir:: mir:: SourceInfo {
330
- span : self . source_info . span . stable ( tables) ,
331
- scope : self . source_info . scope . into ( ) ,
332
- } ,
333
- composite : {
334
- if let Some ( composite) = & self . composite {
335
- Some ( VarDebugInfoFragment {
336
- ty : composite. ty . stable ( tables) ,
337
- projection : composite. projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
338
- } )
339
- } else {
340
- None
341
- }
342
- } ,
343
- value : {
344
- match self . value {
345
- mir:: VarDebugInfoContents :: Place ( place) => {
346
- stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
347
- }
348
- mir:: VarDebugInfoContents :: Const ( const_operand) => {
349
- let op = ConstOperand {
350
- span : const_operand. span . stable ( tables) ,
351
- user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
352
- const_ : const_operand. const_ . stable ( tables) ,
353
- } ;
354
- stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
355
- }
356
- }
357
- } ,
329
+ source_info : self . source_info . stable ( tables) ,
330
+ composite : self . composite . as_ref ( ) . map ( |composite| composite. stable ( tables) ) ,
331
+ value : self . value . stable ( tables) ,
358
332
argument_index : self . argument_index ,
359
333
}
360
334
}
@@ -367,6 +341,42 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
367
341
}
368
342
}
369
343
344
+ impl < ' tcx > Stable < ' tcx > for mir:: SourceInfo {
345
+ type T = stable_mir:: mir:: SourceInfo ;
346
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
347
+ stable_mir:: mir:: SourceInfo { span : self . span . stable ( tables) , scope : self . scope . into ( ) }
348
+ }
349
+ }
350
+
351
+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoFragment < ' tcx > {
352
+ type T = stable_mir:: mir:: VarDebugInfoFragment ;
353
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
354
+ VarDebugInfoFragment {
355
+ ty : self . ty . stable ( tables) ,
356
+ projection : self . projection . iter ( ) . map ( |e| e. stable ( tables) ) . collect ( ) ,
357
+ }
358
+ }
359
+ }
360
+
361
+ impl < ' tcx > Stable < ' tcx > for mir:: VarDebugInfoContents < ' tcx > {
362
+ type T = stable_mir:: mir:: VarDebugInfoContents ;
363
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
364
+ match self {
365
+ mir:: VarDebugInfoContents :: Place ( place) => {
366
+ stable_mir:: mir:: VarDebugInfoContents :: Place ( place. stable ( tables) )
367
+ }
368
+ mir:: VarDebugInfoContents :: Const ( const_operand) => {
369
+ let op = ConstOperand {
370
+ span : const_operand. span . stable ( tables) ,
371
+ user_ty : const_operand. user_ty . map ( |index| index. as_usize ( ) ) ,
372
+ const_ : const_operand. const_ . stable ( tables) ,
373
+ } ;
374
+ stable_mir:: mir:: VarDebugInfoContents :: Const ( op)
375
+ }
376
+ }
377
+ }
378
+ }
379
+
370
380
impl < ' tcx > Stable < ' tcx > for mir:: StatementKind < ' tcx > {
371
381
type T = stable_mir:: mir:: StatementKind ;
372
382
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments