address review comments

This commit is contained in:
Deadbeef 2024-06-26 16:36:42 +00:00
parent 8b2fac9612
commit 65a0bee0b7
18 changed files with 113 additions and 124 deletions

View file

@ -270,7 +270,7 @@ where
goal: Goal<I, Self>,
) -> Vec<Candidate<I>>;
fn consider_builtin_effects_min_candidate(
fn consider_builtin_effects_intersection_candidate(
ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolution>;
@ -425,8 +425,8 @@ where
G::consider_builtin_destruct_candidate(self, goal)
} else if cx.is_lang_item(trait_def_id, TraitSolverLangItem::TransmuteTrait) {
G::consider_builtin_transmute_candidate(self, goal)
} else if tcx.is_lang_item(trait_def_id, TraitSolverLangItem::EffectsMin) {
G::consider_builtin_effects_min_candidate(self, goal)
} else if cx.is_lang_item(trait_def_id, TraitSolverLangItem::EffectsIntersection) {
G::consider_builtin_effects_intersection_candidate(self, goal)
} else {
Err(NoSolution)
};

View file

@ -865,7 +865,7 @@ where
panic!("`BikeshedIntrinsicFrom` does not have an associated type: {:?}", goal)
}
fn consider_builtin_effects_min_candidate(
fn consider_builtin_effects_intersection_candidate(
ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolution> {
@ -903,11 +903,15 @@ where
let mut min = ty::EffectKind::Maybe;
for ty in types.iter() {
// We can't find the intersection if the types used are generic.
//
// FIXME(effects) do we want to look at where clauses to get some
// clue for the case where generic types are being used?
let Some(kind) = ty::EffectKind::try_from_ty(cx, ty) else {
return Err(NoSolution);
};
let Some(result) = ty::EffectKind::min(min, kind) else {
let Some(result) = ty::EffectKind::intersection(min, kind) else {
return Err(NoSolution);
};

View file

@ -703,7 +703,7 @@ where
})
}
fn consider_builtin_effects_min_candidate(
fn consider_builtin_effects_intersection_candidate(
ecx: &mut EvalCtxt<'_, D>,
goal: Goal<I, Self>,
) -> Result<Candidate<I>, NoSolution> {
@ -732,7 +732,7 @@ where
return Err(NoSolution);
};
let Some(result) = ty::EffectKind::min(min, kind) else {
let Some(result) = ty::EffectKind::intersection(min, kind) else {
return Err(NoSolution);
};