@@ -108,6 +108,23 @@ impl<'tcx> Context for Tables<'tcx> {
108108 let generic_def = self . tcx . generics_of ( def_id) ;
109109 generic_def. stable ( self )
110110 }
111+
112+ fn predicates_of (
113+ & mut self ,
114+ trait_def : & stable_mir:: ty:: TraitDef ,
115+ ) -> stable_mir:: GenericPredicates {
116+ let trait_def_id = self . trait_def_id ( trait_def) ;
117+ let ty:: GenericPredicates { parent, predicates } = self . tcx . predicates_of ( trait_def_id) ;
118+ stable_mir:: GenericPredicates {
119+ parent : parent. map ( |did| self . trait_def ( did) ) ,
120+ predicates : predicates
121+ . iter ( )
122+ . map ( |( clause, span) | {
123+ ( clause. as_predicate ( ) . kind ( ) . skip_binder ( ) . stable ( self ) , span. stable ( self ) )
124+ } )
125+ . collect ( ) ,
126+ }
127+ }
111128}
112129
113130pub struct Tables < ' tcx > {
@@ -947,12 +964,12 @@ impl<'tcx> Stable<'tcx> for ty::BoundTyKind {
947964impl < ' tcx > Stable < ' tcx > for ty:: BoundRegionKind {
948965 type T = stable_mir:: ty:: BoundRegionKind ;
949966
950- fn stable ( & self , _ : & mut Tables < ' tcx > ) -> Self :: T {
967+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
951968 use stable_mir:: ty:: BoundRegionKind ;
952969
953970 match self {
954971 ty:: BoundRegionKind :: BrAnon ( option_span) => {
955- BoundRegionKind :: BrAnon ( option_span. map ( |span| opaque ( & span) ) )
972+ BoundRegionKind :: BrAnon ( option_span. map ( |span| span. stable ( tables ) ) )
956973 }
957974 ty:: BoundRegionKind :: BrNamed ( def_id, symbol) => {
958975 BoundRegionKind :: BrNamed ( rustc_internal:: br_named_def ( * def_id) , symbol. to_string ( ) )
@@ -1242,14 +1259,6 @@ impl<'tcx> Stable<'tcx> for ty::Generics {
12421259 }
12431260}
12441261
1245- impl < ' tcx > Stable < ' tcx > for rustc_span:: Span {
1246- type T = stable_mir:: ty:: Span ;
1247-
1248- fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
1249- opaque ( self )
1250- }
1251- }
1252-
12531262impl < ' tcx > Stable < ' tcx > for rustc_middle:: ty:: GenericParamDefKind {
12541263 type T = stable_mir:: ty:: GenericParamDefKind ;
12551264
@@ -1456,3 +1465,12 @@ impl<'tcx> Stable<'tcx> for ty::Region<'tcx> {
14561465 opaque ( self )
14571466 }
14581467}
1468+
1469+ impl < ' tcx > Stable < ' tcx > for rustc_span:: Span {
1470+ type T = stable_mir:: ty:: Span ;
1471+
1472+ fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
1473+ // FIXME: add a real implementation of stable spans
1474+ opaque ( self )
1475+ }
1476+ }
0 commit comments