do not prefer substs relate during coherence

This commit is contained in:
lcnr 2023-05-26 10:59:01 +02:00
parent c86212f9bc
commit e7fa993d89

View File

@ -265,10 +265,18 @@ enum Invert {
if let Some(merged) = self.try_merge_responses(&candidates) {
Ok(merged)
} else if let Ok(subst_relate_response) = subst_relate_response {
Ok(subst_relate_response)
} else {
self.flounder(&candidates)
// When relating two aliases and we have ambiguity, we prefer
// relating the generic arguments of the aliases over normalizing
// them. This is necessary for inference during typeck.
//
// As this is incomplete, we must not do so during coherence.
match (self.solver_mode(), subst_relate_response) {
(SolverMode::Normal, Ok(response)) => Ok(response),
(SolverMode::Normal, Err(NoSolution)) | (SolverMode::Coherence, _) => {
self.flounder(&candidates)
}
}
}
}
}