@@ -264,7 +264,10 @@ where
264264
265265 pub ( super ) fn step_kind_for_source ( & self , source : GoalSource ) -> PathKind {
266266 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 ,
268271 _ => PathKind :: Inductive ,
269272 }
270273 }
@@ -670,16 +673,19 @@ where
670673
671674 #[ instrument( level = "trace" , skip( self ) ) ]
672675 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+ ) ) ;
675681 self . inspect . add_normalizes_to_goal ( self . delegate , self . max_input_universe , goal) ;
676682 self . nested_goals . normalizes_to_goals . push ( goal) ;
677683 }
678684
679685 #[ instrument( level = "debug" , skip( self ) ) ]
680686 pub ( super ) fn add_goal ( & mut self , source : GoalSource , mut goal : Goal < I , I :: Predicate > ) {
681687 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 ) ) ;
683689 self . inspect . add_goal ( self . delegate , self . max_input_universe , source, goal) ;
684690 self . nested_goals . goals . push ( ( source, goal) ) ;
685691 }
@@ -1100,6 +1106,7 @@ where
11001106{
11011107 ecx : & ' me mut EvalCtxt < ' a , D > ,
11021108 param_env : I :: ParamEnv ,
1109+ normalization_goal_source : GoalSource ,
11031110 cache : HashMap < I :: Ty , I :: Ty > ,
11041111}
11051112
@@ -1108,8 +1115,21 @@ where
11081115 D : SolverDelegate < Interner = I > ,
11091116 I : Interner ,
11101117{
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+ }
11131133 }
11141134}
11151135
@@ -1132,7 +1152,7 @@ where
11321152 ty:: AliasRelationDirection :: Equate ,
11331153 ) ;
11341154 self . ecx . add_goal (
1135- GoalSource :: Misc ,
1155+ self . normalization_goal_source ,
11361156 Goal :: new ( self . cx ( ) , self . param_env , normalizes_to) ,
11371157 ) ;
11381158 infer_ty
@@ -1161,7 +1181,7 @@ where
11611181 ty:: AliasRelationDirection :: Equate ,
11621182 ) ;
11631183 self . ecx . add_goal (
1164- GoalSource :: Misc ,
1184+ self . normalization_goal_source ,
11651185 Goal :: new ( self . cx ( ) , self . param_env , normalizes_to) ,
11661186 ) ;
11671187 infer_ct
0 commit comments