@@ -59,6 +59,20 @@ impl<'tcx> Context for Tables<'tcx> {
59
59
trait_def. stable ( self )
60
60
}
61
61
62
+ fn all_trait_impls ( & mut self ) -> stable_mir:: ImplTraitDecls {
63
+ self . tcx
64
+ . trait_impls_in_crate ( LOCAL_CRATE )
65
+ . iter ( )
66
+ . map ( |impl_def_id| self . impl_def ( * impl_def_id) )
67
+ . collect ( )
68
+ }
69
+
70
+ fn trait_impl ( & mut self , impl_def : & stable_mir:: ty:: ImplDef ) -> stable_mir:: ty:: ImplTrait {
71
+ let def_id = self . impl_trait_def_id ( impl_def) ;
72
+ let impl_trait = self . tcx . impl_trait_ref ( def_id) . unwrap ( ) ;
73
+ impl_trait. stable ( self )
74
+ }
75
+
62
76
fn mir_body ( & mut self , item : & stable_mir:: CrateItem ) -> stable_mir:: mir:: Body {
63
77
let def_id = self . item_def_id ( item) ;
64
78
let mir = self . tcx . optimized_mir ( def_id) ;
@@ -840,6 +854,19 @@ where
840
854
}
841
855
}
842
856
857
+ impl < ' tcx , S , V > Stable < ' tcx > for ty:: EarlyBinder < S >
858
+ where
859
+ S : Stable < ' tcx , T = V > ,
860
+ {
861
+ type T = stable_mir:: ty:: EarlyBinder < V > ;
862
+
863
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
864
+ use stable_mir:: ty:: EarlyBinder ;
865
+
866
+ EarlyBinder { value : self . as_ref ( ) . skip_binder ( ) . stable ( tables) }
867
+ }
868
+ }
869
+
843
870
impl < ' tcx > Stable < ' tcx > for ty:: FnSig < ' tcx > {
844
871
type T = stable_mir:: ty:: FnSig ;
845
872
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
@@ -1154,3 +1181,12 @@ impl<'tcx> Stable<'tcx> for rustc_middle::mir::ConstantKind<'tcx> {
1154
1181
}
1155
1182
}
1156
1183
}
1184
+
1185
+ impl < ' tcx > Stable < ' tcx > for ty:: TraitRef < ' tcx > {
1186
+ type T = stable_mir:: ty:: TraitRef ;
1187
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
1188
+ use stable_mir:: ty:: TraitRef ;
1189
+
1190
+ TraitRef { def_id : rustc_internal:: trait_def ( self . def_id ) , args : self . args . stable ( tables) }
1191
+ }
1192
+ }
0 commit comments