@@ -264,7 +264,10 @@ where
264
264
265
265
pub ( super ) fn step_kind_for_source ( & self , source : GoalSource ) -> PathKind {
266
266
match ( self . current_goal_kind , source) {
267
- ( CurrentGoalKind :: CoinductiveTrait , GoalSource :: ImplWhereBound ) => PathKind :: Coinductive ,
267
+ (
268
+ CurrentGoalKind :: CoinductiveTrait ,
269
+ GoalSource :: ImplWhereBound | GoalSource :: NormalizeImplWhereBound ,
270
+ ) => PathKind :: Coinductive ,
268
271
_ => PathKind :: Inductive ,
269
272
}
270
273
}
@@ -670,16 +673,19 @@ where
670
673
671
674
#[ instrument( level = "trace" , skip( self ) ) ]
672
675
pub ( super ) fn add_normalizes_to_goal ( & mut self , mut goal : Goal < I , ty:: NormalizesTo < I > > ) {
673
- goal. predicate =
674
- goal. predicate . fold_with ( & mut ReplaceAliasWithInfer :: new ( self , goal. param_env ) ) ;
676
+ goal. predicate = goal. predicate . fold_with ( & mut ReplaceAliasWithInfer :: new (
677
+ self ,
678
+ GoalSource :: Misc ,
679
+ goal. param_env ,
680
+ ) ) ;
675
681
self . inspect . add_normalizes_to_goal ( self . delegate , self . max_input_universe , goal) ;
676
682
self . nested_goals . normalizes_to_goals . push ( goal) ;
677
683
}
678
684
679
685
#[ instrument( level = "debug" , skip( self ) ) ]
680
686
pub ( super ) fn add_goal ( & mut self , source : GoalSource , mut goal : Goal < I , I :: Predicate > ) {
681
687
goal. predicate =
682
- goal. predicate . fold_with ( & mut ReplaceAliasWithInfer :: new ( self , goal. param_env ) ) ;
688
+ goal. predicate . fold_with ( & mut ReplaceAliasWithInfer :: new ( self , source , goal. param_env ) ) ;
683
689
self . inspect . add_goal ( self . delegate , self . max_input_universe , source, goal) ;
684
690
self . nested_goals . goals . push ( ( source, goal) ) ;
685
691
}
@@ -1100,6 +1106,7 @@ where
1100
1106
{
1101
1107
ecx : & ' me mut EvalCtxt < ' a , D > ,
1102
1108
param_env : I :: ParamEnv ,
1109
+ normalization_goal_source : GoalSource ,
1103
1110
cache : HashMap < I :: Ty , I :: Ty > ,
1104
1111
}
1105
1112
@@ -1108,8 +1115,21 @@ where
1108
1115
D : SolverDelegate < Interner = I > ,
1109
1116
I : Interner ,
1110
1117
{
1111
- fn new ( ecx : & ' me mut EvalCtxt < ' a , D > , param_env : I :: ParamEnv ) -> Self {
1112
- ReplaceAliasWithInfer { ecx, param_env, cache : Default :: default ( ) }
1118
+ fn new (
1119
+ ecx : & ' me mut EvalCtxt < ' a , D > ,
1120
+ for_goal_source : GoalSource ,
1121
+ param_env : I :: ParamEnv ,
1122
+ ) -> Self {
1123
+ let normalization_goal_source = match for_goal_source {
1124
+ GoalSource :: ImplWhereBound => GoalSource :: NormalizeImplWhereBound ,
1125
+ _ => GoalSource :: Misc ,
1126
+ } ;
1127
+ ReplaceAliasWithInfer {
1128
+ ecx,
1129
+ param_env,
1130
+ normalization_goal_source,
1131
+ cache : Default :: default ( ) ,
1132
+ }
1113
1133
}
1114
1134
}
1115
1135
@@ -1132,7 +1152,7 @@ where
1132
1152
ty:: AliasRelationDirection :: Equate ,
1133
1153
) ;
1134
1154
self . ecx . add_goal (
1135
- GoalSource :: Misc ,
1155
+ self . normalization_goal_source ,
1136
1156
Goal :: new ( self . cx ( ) , self . param_env , normalizes_to) ,
1137
1157
) ;
1138
1158
infer_ty
@@ -1161,7 +1181,7 @@ where
1161
1181
ty:: AliasRelationDirection :: Equate ,
1162
1182
) ;
1163
1183
self . ecx . add_goal (
1164
- GoalSource :: Misc ,
1184
+ self . normalization_goal_source ,
1165
1185
Goal :: new ( self . cx ( ) , self . param_env , normalizes_to) ,
1166
1186
) ;
1167
1187
infer_ct
0 commit comments