@@ -16,7 +16,6 @@ use crate::solve::{
1616use rustc_data_structures:: fx:: FxHashSet ;
1717use rustc_index:: IndexVec ;
1818use rustc_infer:: infer:: canonical:: query_response:: make_query_region_constraints;
19- use rustc_infer:: infer:: canonical:: CanonicalVarValues ;
2019use rustc_infer:: infer:: canonical:: { CanonicalExt , QueryRegionConstraints } ;
2120use rustc_infer:: infer:: RegionVariableOrigin ;
2221use rustc_infer:: infer:: { InferCtxt , InferOk } ;
@@ -32,22 +31,24 @@ use rustc_middle::ty::{self, BoundVar, GenericArgKind, Ty, TyCtxt, TypeFoldable}
3231use rustc_next_trait_solver:: canonicalizer:: { CanonicalizeMode , Canonicalizer } ;
3332use rustc_next_trait_solver:: resolve:: EagerResolver ;
3433use rustc_span:: { Span , DUMMY_SP } ;
34+ use rustc_type_ir:: CanonicalVarValues ;
35+ use rustc_type_ir:: { InferCtxtLike , Interner } ;
3536use std:: assert_matches:: assert_matches;
3637use std:: iter;
3738use std:: ops:: Deref ;
3839
3940trait ResponseT < ' tcx > {
40- fn var_values ( & self ) -> CanonicalVarValues < ' tcx > ;
41+ fn var_values ( & self ) -> CanonicalVarValues < TyCtxt < ' tcx > > ;
4142}
4243
4344impl < ' tcx > ResponseT < ' tcx > for Response < TyCtxt < ' tcx > > {
44- fn var_values ( & self ) -> CanonicalVarValues < ' tcx > {
45+ fn var_values ( & self ) -> CanonicalVarValues < TyCtxt < ' tcx > > {
4546 self . var_values
4647 }
4748}
4849
4950impl < ' 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 > > {
5152 self . var_values
5253 }
5354}
@@ -260,7 +261,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
260261 infcx : & InferCtxt < ' tcx > ,
261262 original_values : & [ ty:: GenericArg < ' tcx > ] ,
262263 response : & Canonical < ' tcx , T > ,
263- ) -> CanonicalVarValues < ' tcx > {
264+ ) -> CanonicalVarValues < TyCtxt < ' tcx > > {
264265 // FIXME: Longterm canonical queries should deal with all placeholders
265266 // created inside of the query directly instead of returning them to the
266267 // caller.
@@ -354,7 +355,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
354355 infcx : & InferCtxt < ' tcx > ,
355356 param_env : ty:: ParamEnv < ' tcx > ,
356357 original_values : & [ ty:: GenericArg < ' tcx > ] ,
357- var_values : CanonicalVarValues < ' tcx > ,
358+ var_values : CanonicalVarValues < TyCtxt < ' tcx > > ,
358359 ) {
359360 assert_eq ! ( original_values. len( ) , var_values. len( ) ) ;
360361
@@ -393,13 +394,18 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
393394/// evaluating a goal. The `var_values` not only include the bound variables
394395/// of the query input, but also contain all unconstrained inference vars
395396/// 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 ] ,
399400 max_input_universe : ty:: UniverseIndex ,
400401 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) } ;
403409 let state = inspect:: State { var_values, data } ;
404410 let state = state. fold_with ( & mut EagerResolver :: new ( infcx) ) ;
405411 Canonicalizer :: canonicalize (
0 commit comments