@@ -658,9 +658,9 @@ pub fn fully_normalize_with_fulfillcx<'a, 'gcx, 'tcx, T>(
658
658
/// environment. If this returns false, then either normalize
659
659
/// encountered an error or one of the predicates did not hold. Used
660
660
/// 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
664
664
{
665
665
debug ! ( "normalize_and_test_predicates(predicates={:?})" ,
666
666
predicates) ;
@@ -687,6 +687,22 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
687
687
result
688
688
}
689
689
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
+
690
706
/// Given a trait `trait_ref`, iterates the vtable entries
691
707
/// that come from `trait_ref`, including its supertraits.
692
708
#[ inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
@@ -879,6 +895,7 @@ pub fn provide(providers: &mut ty::maps::Providers) {
879
895
specializes : specialize:: specializes,
880
896
trans_fulfill_obligation : trans:: trans_fulfill_obligation,
881
897
vtable_methods,
898
+ substitute_normalize_and_test_predicates,
882
899
..* providers
883
900
} ;
884
901
}
0 commit comments