@@ -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
}
@@ -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