@@ -3,12 +3,16 @@ use std::rc::Rc;
33
44use rustc_errors:: Diag ;
55use rustc_hir:: def_id:: LocalDefId ;
6- use rustc_infer:: infer:: canonical:: Canonical ;
6+ use rustc_infer:: infer:: canonical:: CanonicalQueryInput ;
77use rustc_infer:: infer:: region_constraints:: { Constraint , RegionConstraintData } ;
88use rustc_infer:: infer:: {
99 InferCtxt , RegionResolutionError , RegionVariableOrigin , SubregionOrigin , TyCtxtInferExt as _,
1010} ;
1111use rustc_infer:: traits:: ObligationCause ;
12+ use rustc_infer:: traits:: query:: {
13+ CanonicalTypeOpAscribeUserTypeGoal , CanonicalTypeOpNormalizeGoal ,
14+ CanonicalTypeOpProvePredicateGoal ,
15+ } ;
1216use rustc_middle:: ty:: error:: TypeError ;
1317use rustc_middle:: ty:: {
1418 self , RePlaceholder , Region , RegionVid , Ty , TyCtxt , TypeFoldable , UniverseIndex ,
@@ -95,9 +99,7 @@ impl<'tcx> ToUniverseInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tc
9599 }
96100}
97101
98- impl < ' tcx > ToUniverseInfo < ' tcx >
99- for Canonical < ' tcx , ty:: ParamEnvAnd < ' tcx , type_op:: prove_predicate:: ProvePredicate < ' tcx > > >
100- {
102+ impl < ' tcx > ToUniverseInfo < ' tcx > for CanonicalTypeOpProvePredicateGoal < ' tcx > {
101103 fn to_universe_info ( self , base_universe : ty:: UniverseIndex ) -> UniverseInfo < ' tcx > {
102104 UniverseInfo ( UniverseInfoInner :: TypeOp ( Rc :: new ( PredicateQuery {
103105 canonical_query : self ,
@@ -107,7 +109,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
107109}
108110
109111impl < ' tcx , T : Copy + fmt:: Display + TypeFoldable < TyCtxt < ' tcx > > + ' tcx > ToUniverseInfo < ' tcx >
110- for Canonical < ' tcx , ty :: ParamEnvAnd < ' tcx , type_op :: Normalize < T > > >
112+ for CanonicalTypeOpNormalizeGoal < ' tcx , T >
111113{
112114 fn to_universe_info ( self , base_universe : ty:: UniverseIndex ) -> UniverseInfo < ' tcx > {
113115 UniverseInfo ( UniverseInfoInner :: TypeOp ( Rc :: new ( NormalizeQuery {
@@ -117,9 +119,7 @@ impl<'tcx, T: Copy + fmt::Display + TypeFoldable<TyCtxt<'tcx>> + 'tcx> ToUnivers
117119 }
118120}
119121
120- impl < ' tcx > ToUniverseInfo < ' tcx >
121- for Canonical < ' tcx , ty:: ParamEnvAnd < ' tcx , type_op:: AscribeUserType < ' tcx > > >
122- {
122+ impl < ' tcx > ToUniverseInfo < ' tcx > for CanonicalTypeOpAscribeUserTypeGoal < ' tcx > {
123123 fn to_universe_info ( self , base_universe : ty:: UniverseIndex ) -> UniverseInfo < ' tcx > {
124124 UniverseInfo ( UniverseInfoInner :: TypeOp ( Rc :: new ( AscribeUserTypeQuery {
125125 canonical_query : self ,
@@ -128,7 +128,7 @@ impl<'tcx> ToUniverseInfo<'tcx>
128128 }
129129}
130130
131- impl < ' tcx , F > ToUniverseInfo < ' tcx > for Canonical < ' tcx , type_op:: custom:: CustomTypeOp < F > > {
131+ impl < ' tcx , F > ToUniverseInfo < ' tcx > for CanonicalQueryInput < ' tcx , type_op:: custom:: CustomTypeOp < F > > {
132132 fn to_universe_info ( self , _base_universe : ty:: UniverseIndex ) -> UniverseInfo < ' tcx > {
133133 // We can't rerun custom type ops.
134134 UniverseInfo :: other ( )
@@ -211,16 +211,15 @@ trait TypeOpInfo<'tcx> {
211211}
212212
213213struct PredicateQuery < ' tcx > {
214- canonical_query :
215- Canonical < ' tcx , ty:: ParamEnvAnd < ' tcx , type_op:: prove_predicate:: ProvePredicate < ' tcx > > > ,
214+ canonical_query : CanonicalTypeOpProvePredicateGoal < ' tcx > ,
216215 base_universe : ty:: UniverseIndex ,
217216}
218217
219218impl < ' tcx > TypeOpInfo < ' tcx > for PredicateQuery < ' tcx > {
220219 fn fallback_error ( & self , tcx : TyCtxt < ' tcx > , span : Span ) -> Diag < ' tcx > {
221220 tcx. dcx ( ) . create_err ( HigherRankedLifetimeError {
222221 cause : Some ( HigherRankedErrorCause :: CouldNotProve {
223- predicate : self . canonical_query . value . value . predicate . to_string ( ) ,
222+ predicate : self . canonical_query . canonical . value . value . predicate . to_string ( ) ,
224223 } ) ,
225224 span,
226225 } )
@@ -253,7 +252,7 @@ impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
253252}
254253
255254struct NormalizeQuery < ' tcx , T > {
256- canonical_query : Canonical < ' tcx , ty :: ParamEnvAnd < ' tcx , type_op :: Normalize < T > > > ,
255+ canonical_query : CanonicalTypeOpNormalizeGoal < ' tcx , T > ,
257256 base_universe : ty:: UniverseIndex ,
258257}
259258
@@ -264,7 +263,7 @@ where
264263 fn fallback_error ( & self , tcx : TyCtxt < ' tcx > , span : Span ) -> Diag < ' tcx > {
265264 tcx. dcx ( ) . create_err ( HigherRankedLifetimeError {
266265 cause : Some ( HigherRankedErrorCause :: CouldNotNormalize {
267- value : self . canonical_query . value . value . value . to_string ( ) ,
266+ value : self . canonical_query . canonical . value . value . value . to_string ( ) ,
268267 } ) ,
269268 span,
270269 } )
@@ -306,7 +305,7 @@ where
306305}
307306
308307struct AscribeUserTypeQuery < ' tcx > {
309- canonical_query : Canonical < ' tcx , ty :: ParamEnvAnd < ' tcx , type_op :: AscribeUserType < ' tcx > > > ,
308+ canonical_query : CanonicalTypeOpAscribeUserTypeGoal < ' tcx > ,
310309 base_universe : ty:: UniverseIndex ,
311310}
312311
0 commit comments