File tree 3 files changed +22
-0
lines changed
3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,23 @@ impl<'tcx> Context for Tables<'tcx> {
135
135
. collect ( ) ,
136
136
}
137
137
}
138
+
139
+ fn explicit_predicates_of (
140
+ & mut self ,
141
+ def_id : stable_mir:: DefId ,
142
+ ) -> stable_mir:: ty:: GenericPredicates {
143
+ let def_id = self [ def_id] ;
144
+ let ty:: GenericPredicates { parent, predicates } = self . tcx . explicit_predicates_of ( def_id) ;
145
+ stable_mir:: ty:: GenericPredicates {
146
+ parent : parent. map ( |did| self . trait_def ( did) ) ,
147
+ predicates : predicates
148
+ . iter ( )
149
+ . map ( |( clause, span) | {
150
+ ( clause. as_predicate ( ) . kind ( ) . skip_binder ( ) . stable ( self ) , span. stable ( self ) )
151
+ } )
152
+ . collect ( ) ,
153
+ }
154
+ }
138
155
}
139
156
140
157
#[ derive( Clone ) ]
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ pub trait Context {
149
149
fn trait_impl ( & mut self , trait_impl : & ImplDef ) -> ImplTrait ;
150
150
fn generics_of ( & mut self , def_id : DefId ) -> Generics ;
151
151
fn predicates_of ( & mut self , def_id : DefId ) -> GenericPredicates ;
152
+ fn explicit_predicates_of ( & mut self , def_id : DefId ) -> GenericPredicates ;
152
153
/// Get information about the local crate.
153
154
fn local_crate ( & self ) -> Crate ;
154
155
/// Retrieve a list of all external crates.
Original file line number Diff line number Diff line change @@ -395,6 +395,10 @@ impl TraitDecl {
395
395
pub fn predicates_of ( & self ) -> GenericPredicates {
396
396
with ( |cx| cx. predicates_of ( self . def_id . 0 ) )
397
397
}
398
+
399
+ pub fn explicit_predicates_of ( & self ) -> GenericPredicates {
400
+ with ( |cx| cx. explicit_predicates_of ( self . def_id . 0 ) )
401
+ }
398
402
}
399
403
400
404
pub type ImplTrait = EarlyBinder < TraitRef > ;
You can’t perform that action at this time.
0 commit comments