@@ -658,9 +658,9 @@ pub fn fully_normalize_with_fulfillcx<'a, 'gcx, 'tcx, T>(
658658/// environment. If this returns false, then either normalize
659659/// encountered an error or one of the predicates did not hold. Used
660660/// when creating vtables to check for unsatisfiable methods.
661- pub fn normalize_and_test_predicates < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
662- predicates : Vec < ty:: Predicate < ' tcx > > )
663- -> bool
661+ fn normalize_and_test_predicates < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
662+ predicates : Vec < ty:: Predicate < ' tcx > > )
663+ -> bool
664664{
665665 debug ! ( "normalize_and_test_predicates(predicates={:?})" ,
666666 predicates) ;
@@ -687,6 +687,22 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
687687 result
688688}
689689
690+ fn substitute_normalize_and_test_predicates < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
691+ key : ( DefId , & ' tcx Substs < ' tcx > ) )
692+ -> bool
693+ {
694+ use ty:: subst:: Subst ;
695+ debug ! ( "substitute_normalize_and_test_predicates(key={:?})" ,
696+ key) ;
697+
698+ let predicates = tcx. predicates_of ( key. 0 ) . predicates . subst ( tcx, key. 1 ) ;
699+ let result = normalize_and_test_predicates ( tcx, predicates) ;
700+
701+ debug ! ( "substitute_normalize_and_test_predicates(key={:?}) = {:?}" ,
702+ key, result) ;
703+ result
704+ }
705+
690706/// Given a trait `trait_ref`, iterates the vtable entries
691707/// that come from `trait_ref`, including its supertraits.
692708#[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
@@ -879,6 +895,7 @@ pub fn provide(providers: &mut ty::maps::Providers) {
879895 specializes : specialize:: specializes,
880896 trans_fulfill_obligation : trans:: trans_fulfill_obligation,
881897 vtable_methods,
898+ substitute_normalize_and_test_predicates,
882899 ..* providers
883900 } ;
884901}
0 commit comments