@@ -132,7 +132,7 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
132132 use mir:: Rvalue :: * ;
133133 match self {
134134 Use ( op) => stable_mir:: mir:: Rvalue :: Use ( op. stable ( tables) ) ,
135- Repeat ( _ , _ ) => todo ! ( ) ,
135+ Repeat ( op , len ) => stable_mir :: mir :: Rvalue :: Repeat ( op . stable ( tables ) , opaque ( len ) ) ,
136136 Ref ( region, kind, place) => stable_mir:: mir:: Rvalue :: Ref (
137137 opaque ( region) ,
138138 kind. stable ( tables) ,
@@ -145,7 +145,11 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
145145 stable_mir:: mir:: Rvalue :: AddressOf ( mutability. stable ( tables) , place. stable ( tables) )
146146 }
147147 Len ( place) => stable_mir:: mir:: Rvalue :: Len ( place. stable ( tables) ) ,
148- Cast ( _, _, _) => todo ! ( ) ,
148+ Cast ( cast_kind, op, ty) => stable_mir:: mir:: Rvalue :: Cast (
149+ cast_kind. stable ( tables) ,
150+ op. stable ( tables) ,
151+ tables. intern_ty ( * ty) ,
152+ ) ,
149153 BinaryOp ( bin_op, ops) => stable_mir:: mir:: Rvalue :: BinaryOp (
150154 bin_op. stable ( tables) ,
151155 ops. 0 . stable ( tables) ,
@@ -163,8 +167,13 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
163167 stable_mir:: mir:: Rvalue :: UnaryOp ( un_op. stable ( tables) , op. stable ( tables) )
164168 }
165169 Discriminant ( place) => stable_mir:: mir:: Rvalue :: Discriminant ( place. stable ( tables) ) ,
166- Aggregate ( _, _) => todo ! ( ) ,
167- ShallowInitBox ( _, _) => todo ! ( ) ,
170+ Aggregate ( agg_kind, operands) => {
171+ let operands = operands. iter ( ) . map ( |op| op. stable ( tables) ) . collect ( ) ;
172+ stable_mir:: mir:: Rvalue :: Aggregate ( agg_kind. stable ( tables) , operands)
173+ }
174+ ShallowInitBox ( op, ty) => {
175+ stable_mir:: mir:: Rvalue :: ShallowInitBox ( op. stable ( tables) , tables. intern_ty ( * ty) )
176+ }
168177 CopyForDeref ( place) => stable_mir:: mir:: Rvalue :: CopyForDeref ( place. stable ( tables) ) ,
169178 }
170179 }
@@ -478,6 +487,40 @@ impl<'tcx> Stable<'tcx> for mir::UnOp {
478487 }
479488}
480489
490+ impl < ' tcx > Stable < ' tcx > for mir:: AggregateKind < ' tcx > {
491+ type T = stable_mir:: mir:: AggregateKind ;
492+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
493+ match self {
494+ mir:: AggregateKind :: Array ( ty) => {
495+ stable_mir:: mir:: AggregateKind :: Array ( tables. intern_ty ( * ty) )
496+ }
497+ mir:: AggregateKind :: Tuple => stable_mir:: mir:: AggregateKind :: Tuple ,
498+ mir:: AggregateKind :: Adt ( def_id, var_idx, generic_arg, user_ty_index, field_idx) => {
499+ stable_mir:: mir:: AggregateKind :: Adt (
500+ rustc_internal:: adt_def ( * def_id) ,
501+ var_idx. index ( ) ,
502+ generic_arg. stable ( tables) ,
503+ user_ty_index. map ( |idx| idx. index ( ) ) ,
504+ field_idx. map ( |idx| idx. index ( ) ) ,
505+ )
506+ }
507+ mir:: AggregateKind :: Closure ( def_id, generic_arg) => {
508+ stable_mir:: mir:: AggregateKind :: Closure (
509+ rustc_internal:: closure_def ( * def_id) ,
510+ generic_arg. stable ( tables) ,
511+ )
512+ }
513+ mir:: AggregateKind :: Generator ( def_id, generic_arg, movability) => {
514+ stable_mir:: mir:: AggregateKind :: Generator (
515+ rustc_internal:: generator_def ( * def_id) ,
516+ generic_arg. stable ( tables) ,
517+ movability. stable ( tables) ,
518+ )
519+ }
520+ }
521+ }
522+ }
523+
481524impl < ' tcx > Stable < ' tcx > for rustc_hir:: GeneratorKind {
482525 type T = stable_mir:: mir:: GeneratorKind ;
483526 fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
0 commit comments