@@ -16,7 +16,6 @@ use crate::solve::{
16
16
use rustc_data_structures:: fx:: FxHashSet ;
17
17
use rustc_index:: IndexVec ;
18
18
use rustc_infer:: infer:: canonical:: query_response:: make_query_region_constraints;
19
- use rustc_infer:: infer:: canonical:: CanonicalVarValues ;
20
19
use rustc_infer:: infer:: canonical:: { CanonicalExt , QueryRegionConstraints } ;
21
20
use rustc_infer:: infer:: RegionVariableOrigin ;
22
21
use rustc_infer:: infer:: { InferCtxt , InferOk } ;
@@ -32,22 +31,24 @@ use rustc_middle::ty::{self, BoundVar, GenericArgKind, Ty, TyCtxt, TypeFoldable}
32
31
use rustc_next_trait_solver:: canonicalizer:: { CanonicalizeMode , Canonicalizer } ;
33
32
use rustc_next_trait_solver:: resolve:: EagerResolver ;
34
33
use rustc_span:: { Span , DUMMY_SP } ;
34
+ use rustc_type_ir:: CanonicalVarValues ;
35
+ use rustc_type_ir:: { InferCtxtLike , Interner } ;
35
36
use std:: assert_matches:: assert_matches;
36
37
use std:: iter;
37
38
use std:: ops:: Deref ;
38
39
39
40
trait ResponseT < ' tcx > {
40
- fn var_values ( & self ) -> CanonicalVarValues < ' tcx > ;
41
+ fn var_values ( & self ) -> CanonicalVarValues < TyCtxt < ' tcx > > ;
41
42
}
42
43
43
44
impl < ' tcx > ResponseT < ' tcx > for Response < TyCtxt < ' tcx > > {
44
- fn var_values ( & self ) -> CanonicalVarValues < ' tcx > {
45
+ fn var_values ( & self ) -> CanonicalVarValues < TyCtxt < ' tcx > > {
45
46
self . var_values
46
47
}
47
48
}
48
49
49
50
impl < ' tcx , T > ResponseT < ' tcx > for inspect:: State < TyCtxt < ' tcx > , T > {
50
- fn var_values ( & self ) -> CanonicalVarValues < ' tcx > {
51
+ fn var_values ( & self ) -> CanonicalVarValues < TyCtxt < ' tcx > > {
51
52
self . var_values
52
53
}
53
54
}
@@ -71,7 +72,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
71
72
QueryInput {
72
73
goal,
73
74
predefined_opaques_in_body : self
74
- . tcx ( )
75
+ . interner ( )
75
76
. mk_predefined_opaques_in_body ( PredefinedOpaquesData { opaque_types } ) ,
76
77
} ,
77
78
) ;
@@ -144,7 +145,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
144
145
Response {
145
146
var_values,
146
147
certainty,
147
- external_constraints : self . tcx ( ) . mk_external_constraints ( external_constraints) ,
148
+ external_constraints : self . interner ( ) . mk_external_constraints ( external_constraints) ,
148
149
} ,
149
150
) ;
150
151
@@ -160,7 +161,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
160
161
maybe_cause : MaybeCause ,
161
162
) -> CanonicalResponse < ' tcx > {
162
163
response_no_constraints_raw (
163
- self . tcx ( ) ,
164
+ self . interner ( ) ,
164
165
self . max_input_universe ,
165
166
self . variables ,
166
167
Certainty :: Maybe ( maybe_cause) ,
@@ -194,7 +195,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
194
195
let region_obligations = self . infcx . inner . borrow ( ) . region_obligations ( ) . to_owned ( ) ;
195
196
let mut region_constraints = self . infcx . with_region_constraints ( |region_constraints| {
196
197
make_query_region_constraints (
197
- self . tcx ( ) ,
198
+ self . interner ( ) ,
198
199
region_obligations. iter ( ) . map ( |r_o| {
199
200
( r_o. sup_type , r_o. sub_region , r_o. origin . to_constraint_category ( ) )
200
201
} ) ,
@@ -239,7 +240,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
239
240
) ;
240
241
241
242
let Response { var_values, external_constraints, certainty } =
242
- response. instantiate ( self . tcx ( ) , & instantiation) ;
243
+ response. instantiate ( self . interner ( ) , & instantiation) ;
243
244
244
245
Self :: unify_query_var_values ( self . infcx , param_env, & original_values, var_values) ;
245
246
@@ -260,7 +261,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
260
261
infcx : & InferCtxt < ' tcx > ,
261
262
original_values : & [ ty:: GenericArg < ' tcx > ] ,
262
263
response : & Canonical < ' tcx , T > ,
263
- ) -> CanonicalVarValues < ' tcx > {
264
+ ) -> CanonicalVarValues < TyCtxt < ' tcx > > {
264
265
// FIXME: Longterm canonical queries should deal with all placeholders
265
266
// created inside of the query directly instead of returning them to the
266
267
// caller.
@@ -354,7 +355,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
354
355
infcx : & InferCtxt < ' tcx > ,
355
356
param_env : ty:: ParamEnv < ' tcx > ,
356
357
original_values : & [ ty:: GenericArg < ' tcx > ] ,
357
- var_values : CanonicalVarValues < ' tcx > ,
358
+ var_values : CanonicalVarValues < TyCtxt < ' tcx > > ,
358
359
) {
359
360
assert_eq ! ( original_values. len( ) , var_values. len( ) ) ;
360
361
@@ -393,13 +394,18 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
393
394
/// evaluating a goal. The `var_values` not only include the bound variables
394
395
/// of the query input, but also contain all unconstrained inference vars
395
396
/// created while evaluating this goal.
396
- pub ( in crate :: solve) fn make_canonical_state < ' tcx , T : TypeFoldable < TyCtxt < ' tcx > > > (
397
- infcx : & InferCtxt < ' tcx > ,
398
- var_values : & [ ty :: GenericArg < ' tcx > ] ,
397
+ pub ( in crate :: solve) fn make_canonical_state < Infcx , T , I > (
398
+ infcx : & Infcx ,
399
+ var_values : & [ I :: GenericArg ] ,
399
400
max_input_universe : ty:: UniverseIndex ,
400
401
data : T ,
401
- ) -> inspect:: CanonicalState < TyCtxt < ' tcx > , T > {
402
- let var_values = CanonicalVarValues { var_values : infcx. tcx . mk_args ( var_values) } ;
402
+ ) -> inspect:: CanonicalState < I , T >
403
+ where
404
+ Infcx : InferCtxtLike < Interner = I > ,
405
+ I : Interner ,
406
+ T : TypeFoldable < I > ,
407
+ {
408
+ let var_values = CanonicalVarValues { var_values : infcx. interner ( ) . mk_args ( var_values) } ;
403
409
let state = inspect:: State { var_values, data } ;
404
410
let state = state. fold_with ( & mut EagerResolver :: new ( infcx) ) ;
405
411
Canonicalizer :: canonicalize (
0 commit comments