2020use infer:: canonical:: substitute:: substitute_value;
2121use infer:: canonical:: {
2222 Canonical , CanonicalVarKind , CanonicalVarValues , CanonicalizedQueryResponse , Certainty ,
23- QueryRegionConstraint , QueryResponse , SmallCanonicalVarValues ,
23+ OriginalQueryValues , QueryRegionConstraint , QueryResponse ,
2424} ;
2525use infer:: region_constraints:: { Constraint , RegionConstraintData } ;
2626use infer:: InferCtxtBuilder ;
@@ -64,11 +64,15 @@ impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> {
6464 K : TypeFoldable < ' tcx > ,
6565 R : Debug + Lift < ' gcx > + TypeFoldable < ' tcx > ,
6666 {
67- self . enter_with_canonical ( DUMMY_SP , canonical_key, |ref infcx, key, canonical_inference_vars| {
68- let fulfill_cx = & mut FulfillmentContext :: new ( ) ;
69- let value = operation ( infcx, fulfill_cx, key) ?;
70- infcx. make_canonicalized_query_response ( canonical_inference_vars, value, fulfill_cx)
71- } )
67+ self . enter_with_canonical (
68+ DUMMY_SP ,
69+ canonical_key,
70+ |ref infcx, key, canonical_inference_vars| {
71+ let fulfill_cx = & mut FulfillmentContext :: new ( ) ;
72+ let value = operation ( infcx, fulfill_cx, key) ?;
73+ infcx. make_canonicalized_query_response ( canonical_inference_vars, value, fulfill_cx)
74+ } ,
75+ )
7276 }
7377}
7478
@@ -153,7 +157,8 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
153157 region_obligations
154158 . iter ( )
155159 . map ( |( _, r_o) | ( r_o. sup_type , r_o. sub_region ) ) ,
156- region_constraints)
160+ region_constraints,
161+ )
157162 } ) ;
158163
159164 let certainty = if ambig_errors. is_empty ( ) {
@@ -184,7 +189,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
184189 & self ,
185190 cause : & ObligationCause < ' tcx > ,
186191 param_env : ty:: ParamEnv < ' tcx > ,
187- original_values : & SmallCanonicalVarValues < ' tcx > ,
192+ original_values : & OriginalQueryValues < ' tcx > ,
188193 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
189194 ) -> InferResult < ' tcx , R >
190195 where
@@ -250,7 +255,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
250255 & self ,
251256 cause : & ObligationCause < ' tcx > ,
252257 param_env : ty:: ParamEnv < ' tcx > ,
253- original_values : & SmallCanonicalVarValues < ' tcx > ,
258+ original_values : & OriginalQueryValues < ' tcx > ,
254259 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
255260 output_query_region_constraints : & mut Vec < QueryRegionConstraint < ' tcx > > ,
256261 ) -> InferResult < ' tcx , R >
@@ -272,7 +277,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
272277 // variable...
273278 let mut obligations = vec ! [ ] ;
274279
275- for ( index, original_value) in original_values. iter ( ) . enumerate ( ) {
280+ for ( index, original_value) in original_values. var_values . iter ( ) . enumerate ( ) {
276281 // ...with the value `v_r` of that variable from the query.
277282 let result_value = query_response. substitute_projected ( self . tcx , & result_subst, |v| {
278283 & v. var_values [ CanonicalVar :: new ( index) ]
@@ -344,7 +349,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
344349 & self ,
345350 cause : & ObligationCause < ' tcx > ,
346351 param_env : ty:: ParamEnv < ' tcx > ,
347- original_values : & SmallCanonicalVarValues < ' tcx > ,
352+ original_values : & OriginalQueryValues < ' tcx > ,
348353 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
349354 ) -> InferResult < ' tcx , CanonicalVarValues < ' tcx > >
350355 where
@@ -385,7 +390,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
385390 fn query_response_substitution_guess < R > (
386391 & self ,
387392 cause : & ObligationCause < ' tcx > ,
388- original_values : & SmallCanonicalVarValues < ' tcx > ,
393+ original_values : & OriginalQueryValues < ' tcx > ,
389394 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
390395 ) -> CanonicalVarValues < ' tcx >
391396 where
@@ -401,7 +406,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
401406 // these values with the original inputs that were
402407 // canonicalized.
403408 let result_values = & query_response. value . var_values ;
404- assert_eq ! ( original_values. len( ) , result_values. len( ) ) ;
409+ assert_eq ! ( original_values. var_values . len( ) , result_values. len( ) ) ;
405410
406411 // Quickly try to find initial values for the canonical
407412 // variables in the result in terms of the query. We do this
@@ -415,7 +420,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
415420
416421 // In terms of our example above, we are iterating over pairs like:
417422 // [(?A, Vec<?0>), ('static, '?1), (?B, ?0)]
418- for ( original_value, result_value) in original_values. iter ( ) . zip ( result_values) {
423+ for ( original_value, result_value) in original_values. var_values . iter ( ) . zip ( result_values) {
419424 match result_value. unpack ( ) {
420425 UnpackedKind :: Type ( result_value) => {
421426 // e.g., here `result_value` might be `?0` in the example above...
@@ -461,7 +466,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
461466 & self ,
462467 cause : & ObligationCause < ' tcx > ,
463468 param_env : ty:: ParamEnv < ' tcx > ,
464- original_values : & SmallCanonicalVarValues < ' tcx > ,
469+ original_values : & OriginalQueryValues < ' tcx > ,
465470 result_subst : & CanonicalVarValues < ' tcx > ,
466471 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
467472 ) -> InferResult < ' tcx , ( ) >
@@ -478,7 +483,12 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
478483
479484 // Unify the original value for each variable with the value
480485 // taken from `query_response` (after applying `result_subst`).
481- Ok ( self . unify_canonical_vars ( cause, param_env, original_values, substituted_query_response) ?)
486+ Ok ( self . unify_canonical_vars (
487+ cause,
488+ param_env,
489+ original_values,
490+ substituted_query_response,
491+ ) ?)
482492 }
483493
484494 /// Converts the region constraints resulting from a query into an
@@ -522,12 +532,12 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
522532 & self ,
523533 cause : & ObligationCause < ' tcx > ,
524534 param_env : ty:: ParamEnv < ' tcx > ,
525- variables1 : & SmallCanonicalVarValues < ' tcx > ,
535+ variables1 : & OriginalQueryValues < ' tcx > ,
526536 variables2 : impl Fn ( CanonicalVar ) -> Kind < ' tcx > ,
527537 ) -> InferResult < ' tcx , ( ) > {
528538 self . commit_if_ok ( |_| {
529539 let mut obligations = vec ! [ ] ;
530- for ( index, value1) in variables1. iter ( ) . enumerate ( ) {
540+ for ( index, value1) in variables1. var_values . iter ( ) . enumerate ( ) {
531541 let value2 = variables2 ( CanonicalVar :: new ( index) ) ;
532542
533543 match ( value1. unpack ( ) , value2. unpack ( ) ) {
0 commit comments