@@ -15,8 +15,10 @@ use rustc_index::{Idx, IndexVec};
15
15
use rustc_middle:: arena:: ArenaAllocatable ;
16
16
use rustc_middle:: mir:: ConstraintCategory ;
17
17
use rustc_middle:: ty:: fold:: TypeFoldable ;
18
+ use rustc_middle:: ty:: traverse:: AlwaysTraversable ;
18
19
use rustc_middle:: ty:: { self , BoundVar , GenericArg , GenericArgKind , Ty , TyCtxt } ;
19
20
use rustc_middle:: { bug, span_bug} ;
21
+ use rustc_type_ir:: traverse:: OptTryFoldWith ;
20
22
use tracing:: { debug, instrument} ;
21
23
22
24
use crate :: infer:: canonical:: instantiate:: { CanonicalExt , instantiate_value} ;
@@ -60,7 +62,7 @@ impl<'tcx> InferCtxt<'tcx> {
60
62
fulfill_cx : & mut dyn TraitEngine < ' tcx , ScrubbedTraitError < ' tcx > > ,
61
63
) -> Result < CanonicalQueryResponse < ' tcx , T > , NoSolution >
62
64
where
63
- T : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
65
+ T : OptTryFoldWith < TyCtxt < ' tcx > > ,
64
66
Canonical < ' tcx , QueryResponse < ' tcx , T > > : ArenaAllocatable < ' tcx > ,
65
67
{
66
68
let query_response = self . make_query_response ( inference_vars, answer, fulfill_cx) ?;
@@ -107,7 +109,7 @@ impl<'tcx> InferCtxt<'tcx> {
107
109
fulfill_cx : & mut dyn TraitEngine < ' tcx , ScrubbedTraitError < ' tcx > > ,
108
110
) -> Result < QueryResponse < ' tcx , T > , NoSolution >
109
111
where
110
- T : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
112
+ T : OptTryFoldWith < TyCtxt < ' tcx > > ,
111
113
{
112
114
let tcx = self . tcx ;
113
115
@@ -243,7 +245,7 @@ impl<'tcx> InferCtxt<'tcx> {
243
245
output_query_region_constraints : & mut QueryRegionConstraints < ' tcx > ,
244
246
) -> InferResult < ' tcx , R >
245
247
where
246
- R : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
248
+ R : OptTryFoldWith < TyCtxt < ' tcx > > ,
247
249
{
248
250
let InferOk { value : result_args, mut obligations } = self
249
251
. query_response_instantiation_guess (
@@ -326,8 +328,11 @@ impl<'tcx> InferCtxt<'tcx> {
326
328
. map ( |p_c| instantiate_value ( self . tcx , & result_args, p_c. clone ( ) ) ) ,
327
329
) ;
328
330
329
- let user_result: R =
330
- query_response. instantiate_projected ( self . tcx , & result_args, |q_r| q_r. value . clone ( ) ) ;
331
+ let user_result: R = query_response
332
+ . instantiate_projected ( self . tcx , & result_args, |q_r| {
333
+ AlwaysTraversable ( q_r. value . clone ( ) )
334
+ } )
335
+ . 0 ;
331
336
332
337
Ok ( InferOk { value : user_result, obligations } )
333
338
}
@@ -396,7 +401,7 @@ impl<'tcx> InferCtxt<'tcx> {
396
401
query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
397
402
) -> InferResult < ' tcx , CanonicalVarValues < ' tcx > >
398
403
where
399
- R : Debug + TypeFoldable < TyCtxt < ' tcx > > ,
404
+ R : OptTryFoldWith < TyCtxt < ' tcx > > ,
400
405
{
401
406
// For each new universe created in the query result that did
402
407
// not appear in the original query, create a local
0 commit comments