Make names more accurate

This commit is contained in:
Michael Goulet 2024-04-26 12:36:33 -04:00
parent 7a58674259
commit 5776aec662
3 changed files with 29 additions and 15 deletions

View File

@ -56,7 +56,7 @@ pub(super) trait GoalKind<'tcx>:
/// Consider a clause, which consists of a "assumption" and some "requirements",
/// to satisfy a goal. If the requirements hold, then attempt to satisfy our
/// goal by equating it with the assumption.
fn consider_implied_clause(
fn probe_and_consider_implied_clause(
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
assumption: ty::Clause<'tcx>,
@ -73,7 +73,7 @@ pub(super) trait GoalKind<'tcx>:
/// Consider a clause specifically for a `dyn Trait` self type. This requires
/// additionally checking all of the supertraits and object bounds to hold,
/// since they're not implied by the well-formedness of the object type.
fn consider_object_bound_candidate(
fn probe_and_consider_object_bound_candidate(
ecx: &mut EvalCtxt<'_, 'tcx>,
goal: Goal<'tcx, Self>,
assumption: ty::Clause<'tcx>,
@ -81,7 +81,7 @@ pub(super) trait GoalKind<'tcx>:
Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| {
let tcx = ecx.tcx();
let ty::Dynamic(bounds, _, _) = *goal.predicate.self_ty().kind() else {
bug!("expected object type in `consider_object_bound_candidate`");
bug!("expected object type in `probe_and_consider_object_bound_candidate`");
};
// FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`?
ecx.add_goals(
@ -557,7 +557,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
candidates: &mut Vec<Candidate<'tcx>>,
) {
for (i, assumption) in goal.param_env.caller_bounds().iter().enumerate() {
match G::consider_implied_clause(self, goal, assumption, []) {
match G::probe_and_consider_implied_clause(self, goal, assumption, []) {
Ok(result) => {
candidates.push(Candidate { source: CandidateSource::ParamEnv(i), result })
}
@ -648,7 +648,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
for assumption in
self.tcx().item_bounds(alias_ty.def_id).instantiate(self.tcx(), alias_ty.args)
{
match G::consider_implied_clause(self, goal, assumption, []) {
match G::probe_and_consider_implied_clause(self, goal, assumption, []) {
Ok(result) => {
candidates.push(Candidate { source: CandidateSource::AliasBound, result });
}
@ -728,7 +728,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
ty::ExistentialPredicate::Projection(_)
| ty::ExistentialPredicate::AutoTrait(_) => {
match G::consider_object_bound_candidate(
match G::probe_and_consider_object_bound_candidate(
self,
goal,
bound.with_self_ty(tcx, self_ty),
@ -749,7 +749,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
if let Some(principal) = bounds.principal() {
let principal_trait_ref = principal.with_self_ty(tcx, self_ty);
self.walk_vtable(principal_trait_ref, |ecx, assumption, vtable_base, _| {
match G::consider_object_bound_candidate(ecx, goal, assumption.to_predicate(tcx)) {
match G::probe_and_consider_object_bound_candidate(
ecx,
goal,
assumption.to_predicate(tcx),
) {
Ok(result) => candidates.push(Candidate {
source: CandidateSource::BuiltinImpl(BuiltinImplSource::Object {
vtable_base,

View File

@ -385,7 +385,12 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
// A built-in `Fn` impl only holds if the output is sized.
// (FIXME: technically we only need to check this if the type is a fn ptr...)
Self::consider_implied_clause(ecx, goal, pred, [goal.with(tcx, output_is_sized_pred)])
Self::probe_and_consider_implied_clause(
ecx,
goal,
pred,
[goal.with(tcx, output_is_sized_pred)],
)
}
fn consider_builtin_async_fn_trait_candidates(
@ -461,7 +466,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
// A built-in `AsyncFn` impl only holds if the output is sized.
// (FIXME: technically we only need to check this if the type is a fn ptr...)
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
pred,
@ -623,7 +628,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
let term = args.as_coroutine().return_ty().into();
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
ty::ProjectionPredicate {
@ -654,7 +659,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
let term = args.as_coroutine().yield_ty().into();
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
ty::ProjectionPredicate {
@ -737,7 +742,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
bug!("unexpected associated item `<{self_ty} as Coroutine>::{name}`")
};
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
ty::ProjectionPredicate {

View File

@ -307,7 +307,12 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
.to_predicate(tcx);
// A built-in `Fn` impl only holds if the output is sized.
// (FIXME: technically we only need to check this if the type is a fn ptr...)
Self::consider_implied_clause(ecx, goal, pred, [goal.with(tcx, output_is_sized_pred)])
Self::probe_and_consider_implied_clause(
ecx,
goal,
pred,
[goal.with(tcx, output_is_sized_pred)],
)
}
fn consider_builtin_async_fn_trait_candidates(
@ -345,7 +350,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
.to_predicate(tcx);
// A built-in `AsyncFn` impl only holds if the output is sized.
// (FIXME: technically we only need to check this if the type is a fn ptr...)
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
pred,
@ -521,7 +526,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
}
let coroutine = args.as_coroutine();
Self::consider_implied_clause(
Self::probe_and_consider_implied_clause(
ecx,
goal,
ty::TraitRef::new(tcx, goal.predicate.def_id(), [self_ty, coroutine.resume_ty()])