1
Fork 0

Rigidly project missing item due to guaranteed impossible sized predicate

This commit is contained in:
Michael Goulet 2025-03-26 18:57:13 +00:00
parent 48f89e7659
commit 27836e1e57
8 changed files with 281 additions and 52 deletions

View file

@ -232,7 +232,17 @@ where
};
if !cx.has_item_definition(target_item_def_id) {
return error_response(ecx, cx.delay_bug("missing item"));
// If the impl is missing an item, it's either because the user forgot to
// provide it, or the user is not *obligated* to provide it (because it
// has a trivially false `Sized` predicate). If it's the latter, we cannot
// delay a bug because we can have trivially false where clauses, so we
// treat it as rigid.
if goal_trait_ref.self_ty().is_guaranteed_unsized_raw() {
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"));
}
}
let target_container_def_id = cx.parent(target_item_def_id);