@@ -15,9 +15,9 @@ use rustc_middle::mir::{BinOp, Body, Const as MirConst, ConstValue, UnOp};
1515use rustc_middle:: ty:: layout:: { FnAbiOf , LayoutOf } ;
1616use rustc_middle:: ty:: print:: { with_forced_trimmed_paths, with_no_trimmed_paths} ;
1717use rustc_middle:: ty:: {
18- AdtDef , AdtKind , AssocItem , ClosureKind , GenericArgsRef , GenericPredicates , Instance ,
19- InstanceKind , IntrinsicDef , List , PolyFnSig , ScalarInt , TraitDef , Ty , TyCtxt , TyKind ,
20- TypeVisitableExt , UintTy , ValTree , VariantDef ,
18+ AdtDef , AdtKind , AssocItem , ClosureKind , GenericArgsRef , Instance , InstanceKind , IntrinsicDef ,
19+ List , PolyFnSig , ScalarInt , TraitDef , Ty , TyCtxt , TyKind , TypeVisitableExt , UintTy , ValTree ,
20+ VariantDef ,
2121} ;
2222use rustc_middle:: { mir, ty} ;
2323use rustc_session:: cstore:: ForeignModule ;
@@ -197,12 +197,32 @@ impl<'tcx, B: Bridge> SmirCtxt<'tcx, B> {
197197 self . tcx . generics_of ( def_id)
198198 }
199199
200- pub fn predicates_of ( & self , def_id : DefId ) -> GenericPredicates < ' tcx > {
201- self . tcx . predicates_of ( def_id)
200+ pub fn predicates_of (
201+ & self ,
202+ def_id : DefId ,
203+ ) -> ( Option < DefId > , Vec < ( ty:: PredicateKind < ' tcx > , Span ) > ) {
204+ let ty:: GenericPredicates { parent, predicates } = self . tcx . predicates_of ( def_id) ;
205+ (
206+ parent,
207+ predicates
208+ . iter ( )
209+ . map ( |( clause, span) | ( clause. as_predicate ( ) . kind ( ) . skip_binder ( ) , * span) )
210+ . collect ( ) ,
211+ )
202212 }
203213
204- pub fn explicit_predicates_of ( & self , def_id : DefId ) -> GenericPredicates < ' tcx > {
205- self . tcx . explicit_predicates_of ( def_id)
214+ pub fn explicit_predicates_of (
215+ & self ,
216+ def_id : DefId ,
217+ ) -> ( Option < DefId > , Vec < ( ty:: PredicateKind < ' tcx > , Span ) > ) {
218+ let ty:: GenericPredicates { parent, predicates } = self . tcx . explicit_predicates_of ( def_id) ;
219+ (
220+ parent,
221+ predicates
222+ . iter ( )
223+ . map ( |( clause, span) | ( clause. as_predicate ( ) . kind ( ) . skip_binder ( ) , * span) )
224+ . collect ( ) ,
225+ )
206226 }
207227
208228 pub fn crate_name ( & self , crate_num : CrateNum ) -> String {
0 commit comments