@@ -42,6 +42,7 @@ use rustc_middle::mir::interpret::ErrorHandled;
4242use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
4343use rustc_middle:: ty:: fast_reject:: { DeepRejectCtxt , TreatParams } ;
4444use rustc_middle:: ty:: fold:: BottomUpFolder ;
45+ use rustc_middle:: ty:: print:: { FmtPrinter , Print } ;
4546use rustc_middle:: ty:: relate:: TypeRelation ;
4647use rustc_middle:: ty:: SubstsRef ;
4748use rustc_middle:: ty:: { self , EarlyBinder , PolyProjectionPredicate , ToPolyTraitRef , ToPredicate } ;
@@ -1081,11 +1082,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10811082 it. for_each ( |o| o. recursion_depth = cmp:: max ( min_depth, o. recursion_depth ) + 1 ) ;
10821083 }
10831084
1084- fn check_recursion_depth < T : Display + TypeFoldable < ' tcx > > (
1085+ fn check_recursion_depth < T > (
10851086 & self ,
10861087 depth : usize ,
10871088 error_obligation : & Obligation < ' tcx , T > ,
1088- ) -> Result < ( ) , OverflowError > {
1089+ ) -> Result < ( ) , OverflowError >
1090+ where
1091+ T : fmt:: Display
1092+ + TypeFoldable < ' tcx >
1093+ + Print < ' tcx , FmtPrinter < ' tcx , ' tcx > , Output = FmtPrinter < ' tcx , ' tcx > > ,
1094+ <T as Print < ' tcx , FmtPrinter < ' tcx , ' tcx > > >:: Error : std:: fmt:: Debug ,
1095+ {
10891096 if !self . infcx . tcx . recursion_limit ( ) . value_within_limit ( depth) {
10901097 match self . query_mode {
10911098 TraitQueryMode :: Standard => {
@@ -1109,11 +1116,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11091116 /// The weird return type of this function allows it to be used with the `try` (`?`)
11101117 /// operator within certain functions.
11111118 #[ inline( always) ]
1112- fn check_recursion_limit < T : Display + TypeFoldable < ' tcx > , V : Display + TypeFoldable < ' tcx > > (
1119+ fn check_recursion_limit < T : Display + TypeFoldable < ' tcx > , V > (
11131120 & self ,
11141121 obligation : & Obligation < ' tcx , T > ,
11151122 error_obligation : & Obligation < ' tcx , V > ,
1116- ) -> Result < ( ) , OverflowError > {
1123+ ) -> Result < ( ) , OverflowError >
1124+ where
1125+ V : fmt:: Display
1126+ + TypeFoldable < ' tcx >
1127+ + Print < ' tcx , FmtPrinter < ' tcx , ' tcx > , Output = FmtPrinter < ' tcx , ' tcx > > ,
1128+ <V as Print < ' tcx , FmtPrinter < ' tcx , ' tcx > > >:: Error : std:: fmt:: Debug ,
1129+ {
11171130 self . check_recursion_depth ( obligation. recursion_depth , error_obligation)
11181131 }
11191132
0 commit comments