@@ -49,7 +49,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
4949 /// - Finally, if any of the obligations result in a hard error,
5050 /// then `Err(NoSolution)` is returned.
5151 pub fn make_canonicalized_query_response < T > (
52- & self ,
52+ & mut self ,
5353 inference_vars : CanonicalVarValues < ' tcx > ,
5454 answer : T ,
5555 fulfill_cx : & mut dyn TraitEngine < ' tcx > ,
@@ -94,7 +94,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
9494 /// Helper for `make_canonicalized_query_response` that does
9595 /// everything up until the final canonicalization.
9696 fn make_query_response < T > (
97- & self ,
97+ & mut self ,
9898 inference_vars : CanonicalVarValues < ' tcx > ,
9999 answer : T ,
100100 fulfill_cx : & mut dyn TraitEngine < ' tcx > ,
@@ -156,7 +156,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
156156 ///
157157 /// [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html#processing-the-canonicalized-query-result
158158 pub fn instantiate_query_response_and_region_obligations < R > (
159- & self ,
159+ & mut self ,
160160 cause : & ObligationCause < ' tcx > ,
161161 param_env : ty:: ParamEnv < ' tcx > ,
162162 original_values : & OriginalQueryValues < ' tcx > ,
@@ -217,7 +217,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
217217 /// - Finally, the query result (of type `R`) is propagated back,
218218 /// after applying the substitution `S`.
219219 pub fn instantiate_nll_query_response_and_region_obligations < R > (
220- & self ,
220+ & mut self ,
221221 cause : & ObligationCause < ' tcx > ,
222222 param_env : ty:: ParamEnv < ' tcx > ,
223223 original_values : & OriginalQueryValues < ' tcx > ,
@@ -334,7 +334,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
334334 /// assigned to a type variable is unified with an unnormalized
335335 /// projection.
336336 fn query_response_substitution < R > (
337- & self ,
337+ & mut self ,
338338 cause : & ObligationCause < ' tcx > ,
339339 param_env : ty:: ParamEnv < ' tcx > ,
340340 original_values : & OriginalQueryValues < ' tcx > ,
@@ -374,7 +374,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
374374 /// variable instead. Therefore, the result of this method must be
375375 /// properly unified
376376 fn query_response_substitution_guess < R > (
377- & self ,
377+ & mut self ,
378378 cause : & ObligationCause < ' tcx > ,
379379 original_values : & OriginalQueryValues < ' tcx > ,
380380 query_response : & Canonical < ' tcx , QueryResponse < ' tcx , R > > ,
@@ -487,7 +487,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
487487 ///
488488 /// See also: `query_response_substitution_guess`
489489 fn unify_query_response_substitution_guess < R > (
490- & self ,
490+ & mut self ,
491491 cause : & ObligationCause < ' tcx > ,
492492 param_env : ty:: ParamEnv < ' tcx > ,
493493 original_values : & OriginalQueryValues < ' tcx > ,
@@ -501,8 +501,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
501501 // canonical variable; this is taken from
502502 // `query_response.var_values` after applying the substitution
503503 // `result_subst`.
504+ let tcx = self . tcx ;
504505 let substituted_query_response = |index : BoundVar | -> GenericArg < ' tcx > {
505- query_response. substitute_projected ( self . tcx , & result_subst, |v| v. var_values [ index] )
506+ query_response. substitute_projected ( tcx, & result_subst, |v| v. var_values [ index] )
506507 } ;
507508
508509 // Unify the original value for each variable with the value
@@ -550,21 +551,21 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
550551 /// Given two sets of values for the same set of canonical variables, unify them.
551552 /// The second set is produced lazily by supplying indices from the first set.
552553 fn unify_canonical_vars (
553- & self ,
554+ & mut self ,
554555 cause : & ObligationCause < ' tcx > ,
555556 param_env : ty:: ParamEnv < ' tcx > ,
556557 variables1 : & OriginalQueryValues < ' tcx > ,
557558 variables2 : impl Fn ( BoundVar ) -> GenericArg < ' tcx > ,
558559 ) -> InferResult < ' tcx , ( ) > {
559- self . commit_if_ok ( |_| {
560+ self . commit_if_ok ( |this , _| {
560561 let mut obligations = vec ! [ ] ;
561562 for ( index, value1) in variables1. var_values . iter ( ) . enumerate ( ) {
562563 let value2 = variables2 ( BoundVar :: new ( index) ) ;
563564
564565 match ( value1. unpack ( ) , value2. unpack ( ) ) {
565566 ( GenericArgKind :: Type ( v1) , GenericArgKind :: Type ( v2) ) => {
566567 obligations
567- . extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
568+ . extend ( this . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
568569 }
569570 (
570571 GenericArgKind :: Lifetime ( ty:: ReErased ) ,
@@ -574,10 +575,10 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
574575 }
575576 ( GenericArgKind :: Lifetime ( v1) , GenericArgKind :: Lifetime ( v2) ) => {
576577 obligations
577- . extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
578+ . extend ( this . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
578579 }
579580 ( GenericArgKind :: Const ( v1) , GenericArgKind :: Const ( v2) ) => {
580- let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
581+ let ok = this . at ( cause, param_env) . eq ( v1, v2) ?;
581582 obligations. extend ( ok. into_obligations ( ) ) ;
582583 }
583584 _ => {
0 commit comments