File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,20 @@ impl<'tcx> Context for Tables<'tcx> {
135
135
. collect ( ) ,
136
136
}
137
137
}
138
+
139
+ fn explicit_predicates_of ( & mut self , def_id : stable_mir:: DefId ) -> stable_mir:: ty:: GenericPredicates {
140
+ let def_id = self [ def_id] ;
141
+ let ty:: GenericPredicates { parent, predicates } = self . tcx . explicit_predicates_of ( def_id) ;
142
+ stable_mir:: ty:: GenericPredicates {
143
+ parent : parent. map ( |did| self . trait_def ( did) ) ,
144
+ predicates : predicates
145
+ . iter ( )
146
+ . map ( |( clause, span) | {
147
+ ( clause. as_predicate ( ) . kind ( ) . skip_binder ( ) . stable ( self ) , span. stable ( self ) )
148
+ } )
149
+ . collect ( ) ,
150
+ }
151
+ }
138
152
}
139
153
140
154
#[ 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