@@ -41,6 +41,13 @@ impl<'tcx> Context for Tables<'tcx> {
4141 fn entry_fn ( & mut self ) -> Option < stable_mir:: CrateItem > {
4242 Some ( self . crate_item ( self . tcx . entry_fn ( ( ) ) ?. 0 ) )
4343 }
44+
45+ fn trait_decl ( & mut self , trait_def : & stable_mir:: ty:: TraitDef ) -> stable_mir:: ty:: TraitDecl {
46+ let def_id = self . trait_def_id ( trait_def) ;
47+ let trait_def = self . tcx . trait_def ( def_id) ;
48+ trait_def. stable ( self )
49+ }
50+
4451 fn mir_body ( & mut self , item : & stable_mir:: CrateItem ) -> stable_mir:: mir:: Body {
4552 let def_id = self . item_def_id ( item) ;
4653 let mir = self . tcx . optimized_mir ( def_id) ;
@@ -515,7 +522,7 @@ impl<'tcx> Stable<'tcx> for mir::RetagKind {
515522 }
516523}
517524
518- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: UserTypeAnnotationIndex {
525+ impl < ' tcx > Stable < ' tcx > for ty:: UserTypeAnnotationIndex {
519526 type T = usize ;
520527 fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
521528 self . as_usize ( )
@@ -1045,15 +1052,15 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
10451052 }
10461053}
10471054
1048- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: ParamTy {
1055+ impl < ' tcx > Stable < ' tcx > for ty:: ParamTy {
10491056 type T = stable_mir:: ty:: ParamTy ;
10501057 fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
10511058 use stable_mir:: ty:: ParamTy ;
10521059 ParamTy { index : self . index , name : self . name . to_string ( ) }
10531060 }
10541061}
10551062
1056- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: BoundTy {
1063+ impl < ' tcx > Stable < ' tcx > for ty:: BoundTy {
10571064 type T = stable_mir:: ty:: BoundTy ;
10581065 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
10591066 use stable_mir:: ty:: BoundTy ;
@@ -1091,3 +1098,42 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation {
10911098 }
10921099 }
10931100}
1101+
1102+ impl < ' tcx > Stable < ' tcx > for ty:: trait_def:: TraitSpecializationKind {
1103+ type T = stable_mir:: ty:: TraitSpecializationKind ;
1104+ fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
1105+ use stable_mir:: ty:: TraitSpecializationKind ;
1106+
1107+ match self {
1108+ ty:: trait_def:: TraitSpecializationKind :: None => TraitSpecializationKind :: None ,
1109+ ty:: trait_def:: TraitSpecializationKind :: Marker => TraitSpecializationKind :: Marker ,
1110+ ty:: trait_def:: TraitSpecializationKind :: AlwaysApplicable => {
1111+ TraitSpecializationKind :: AlwaysApplicable
1112+ }
1113+ }
1114+ }
1115+ }
1116+
1117+ impl < ' tcx > Stable < ' tcx > for ty:: TraitDef {
1118+ type T = stable_mir:: ty:: TraitDecl ;
1119+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
1120+ use stable_mir:: ty:: TraitDecl ;
1121+
1122+ TraitDecl {
1123+ def_id : rustc_internal:: trait_def ( self . def_id ) ,
1124+ unsafety : self . unsafety . stable ( tables) ,
1125+ paren_sugar : self . paren_sugar ,
1126+ has_auto_impl : self . has_auto_impl ,
1127+ is_marker : self . is_marker ,
1128+ is_coinductive : self . is_coinductive ,
1129+ skip_array_during_method_dispatch : self . skip_array_during_method_dispatch ,
1130+ specialization_kind : self . specialization_kind . stable ( tables) ,
1131+ must_implement_one_of : self
1132+ . must_implement_one_of
1133+ . as_ref ( )
1134+ . map ( |idents| idents. iter ( ) . map ( |ident| opaque ( ident) ) . collect ( ) ) ,
1135+ implement_via_object : self . implement_via_object ,
1136+ deny_explicit_impl : self . deny_explicit_impl ,
1137+ }
1138+ }
1139+ }
0 commit comments