1
Fork 0

Make unnormalizable item ambiguous in coherence

This commit is contained in:
Michael Goulet 2025-03-31 18:56:09 +00:00
parent 830aeb6102
commit 6cd724bb43
3 changed files with 78 additions and 2 deletions

View file

@ -238,8 +238,24 @@ where
// delay a bug because we can have trivially false where clauses, so we
// treat it as rigid.
if cx.impl_self_is_guaranteed_unsized(impl_def_id) {
ecx.structurally_instantiate_normalizes_to_term(goal, goal.predicate.alias);
return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
match ecx.typing_mode() {
ty::TypingMode::Coherence => {
return ecx.evaluate_added_goals_and_make_canonical_response(
Certainty::AMBIGUOUS,
);
}
ty::TypingMode::Analysis { .. }
| ty::TypingMode::Borrowck { .. }
| ty::TypingMode::PostBorrowckAnalysis { .. }
| ty::TypingMode::PostAnalysis => {
ecx.structurally_instantiate_normalizes_to_term(
goal,
goal.predicate.alias,
);
return ecx
.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
}
}
} else {
return error_response(ecx, cx.delay_bug("missing item"));
}