rename `select_where_possible` and `select_all_or_error`
diff --git a/crates/hir-ty/src/autoderef.rs b/crates/hir-ty/src/autoderef.rs
index 21a86d3..4d348ec 100644
--- a/crates/hir-ty/src/autoderef.rs
+++ b/crates/hir-ty/src/autoderef.rs
@@ -304,7 +304,7 @@
// evaluate/fulfill mismatches, but that's not a reason for an ICE.
return None;
};
- let errors = ocx.select_where_possible();
+ let errors = ocx.try_evaluate_obligations();
if !errors.is_empty() {
unreachable!();
}
diff --git a/crates/hir-ty/src/infer/coerce.rs b/crates/hir-ty/src/infer/coerce.rs
index 62ce00a..0ca696e 100644
--- a/crates/hir-ty/src/infer/coerce.rs
+++ b/crates/hir-ty/src/infer/coerce.rs
@@ -160,7 +160,7 @@
Ok(InferOk { value, obligations }) => {
let mut ocx = ObligationCtxt::new(this.infer_ctxt());
ocx.register_obligations(obligations);
- if ocx.select_where_possible().is_empty() {
+ if ocx.try_evaluate_obligations().is_empty() {
Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
} else {
Err(TypeError::Mismatch)
@@ -743,7 +743,7 @@
Some(PredicateKind::AliasRelate(..)) => {
let mut ocx = ObligationCtxt::new(self.infer_ctxt());
ocx.register_obligation(obligation);
- if !ocx.select_where_possible().is_empty() {
+ if !ocx.try_evaluate_obligations().is_empty() {
return Err(TypeError::Mismatch);
}
coercion.obligations.extend(ocx.into_pending_obligations());
@@ -1119,7 +1119,7 @@
prev_ty,
new_ty,
)?;
- if ocx.select_where_possible().is_empty() {
+ if ocx.try_evaluate_obligations().is_empty() {
Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
} else {
Err(TypeError::Mismatch)
diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs
index ddf632c..7b404bb 100644
--- a/crates/hir-ty/src/infer/expr.rs
+++ b/crates/hir-ty/src/infer/expr.rs
@@ -2151,7 +2151,7 @@
expected_output.to_nextsolver(interner),
formal_output,
)?;
- if !ocx.select_where_possible().is_empty() {
+ if !ocx.try_evaluate_obligations().is_empty() {
return Err(crate::next_solver::TypeError::Mismatch);
}
diff --git a/crates/hir-ty/src/infer/unify.rs b/crates/hir-ty/src/infer/unify.rs
index 108cf5b..d8ca029 100644
--- a/crates/hir-ty/src/infer/unify.rs
+++ b/crates/hir-ty/src/infer/unify.rs
@@ -818,7 +818,7 @@
}
pub(crate) fn select_obligations_where_possible(&mut self) {
- self.fulfillment_cx.select_where_possible(&self.infer_ctxt);
+ self.fulfillment_cx.try_evaluate_obligations(&self.infer_ctxt);
}
pub(super) fn register_predicate(
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs
index 61d3091..9b330d3 100644
--- a/crates/hir-ty/src/method_resolution.rs
+++ b/crates/hir-ty/src/method_resolution.rs
@@ -1785,7 +1785,7 @@
let mut ctxt = ObligationCtxt::new(&table.infer_ctxt);
ctxt.register_obligations(infer_ok.into_obligations());
// FIXME: Are we doing this correctly? Probably better to follow rustc more closely.
- check_that!(ctxt.select_where_possible().is_empty());
+ check_that!(ctxt.try_evaluate_obligations().is_empty());
}
check_that!(table.unify(receiver_ty, &expected_receiver));
@@ -1871,7 +1871,7 @@
)
}));
- if ctxt.select_where_possible().is_empty() {
+ if ctxt.try_evaluate_obligations().is_empty() {
IsValidCandidate::Yes
} else {
IsValidCandidate::No
diff --git a/crates/hir-ty/src/next_solver/fulfill.rs b/crates/hir-ty/src/next_solver/fulfill.rs
index 34dff37..262da85 100644
--- a/crates/hir-ty/src/next_solver/fulfill.rs
+++ b/crates/hir-ty/src/next_solver/fulfill.rs
@@ -54,7 +54,7 @@
/// Obligations which resulted in an overflow in fulfillment itself.
///
/// We cannot eagerly return these as error so we instead store them here
- /// to avoid recomputing them each time `select_where_possible` is called.
+ /// to avoid recomputing them each time `try_evaluate_obligations` is called.
/// This also allows us to return the correct `FulfillmentError` for them.
overflowed: Vec<PredicateObligation<'db>>,
pending: PendingObligations<'db>,
@@ -95,7 +95,7 @@
// IMPORTANT: we must not use solve any inference variables in the obligations
// as this is all happening inside of a probe. We use a probe to make sure
// we get all obligations involved in the overflow. We pretty much check: if
- // we were to do another step of `select_where_possible`, which goals would
+ // we were to do another step of `try_evaluate_obligations`, which goals would
// change.
// FIXME: <https://github.com/Gankra/thin-vec/pull/66> is merged, this can be removed.
self.overflowed.extend(
@@ -131,7 +131,7 @@
infcx: &InferCtxt<'db>,
obligation: PredicateObligation<'db>,
) {
- // FIXME: See the comment in `select_where_possible()`.
+ // FIXME: See the comment in `try_evaluate_obligations()`.
// assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
self.obligations.register(obligation, None);
}
@@ -141,7 +141,7 @@
infcx: &InferCtxt<'db>,
obligations: impl IntoIterator<Item = PredicateObligation<'db>>,
) {
- // FIXME: See the comment in `select_where_possible()`.
+ // FIXME: See the comment in `try_evaluate_obligations()`.
// assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
obligations.into_iter().for_each(|obligation| self.obligations.register(obligation, None));
}
@@ -158,7 +158,7 @@
.collect()
}
- pub(crate) fn select_where_possible(
+ pub(crate) fn try_evaluate_obligations(
&mut self,
infcx: &InferCtxt<'db>,
) -> Vec<NextSolverError<'db>> {
@@ -223,11 +223,11 @@
errors
}
- pub(crate) fn select_all_or_error(
+ pub(crate) fn evaluate_obligations_error_on_ambiguity(
&mut self,
infcx: &InferCtxt<'db>,
) -> Vec<NextSolverError<'db>> {
- let errors = self.select_where_possible(infcx);
+ let errors = self.try_evaluate_obligations(infcx);
if !errors.is_empty() {
return errors;
}
diff --git a/crates/hir-ty/src/next_solver/inspect.rs b/crates/hir-ty/src/next_solver/inspect.rs
index bc19d51..0db4746 100644
--- a/crates/hir-ty/src/next_solver/inspect.rs
+++ b/crates/hir-ty/src/next_solver/inspect.rs
@@ -92,7 +92,7 @@
let mut ocx = ObligationCtxt::new(infcx);
ocx.eq(&ObligationCause::dummy(), param_env, self.term, self.unconstrained_term)?;
f(&mut ocx);
- let errors = ocx.select_all_or_error();
+ let errors = ocx.evaluate_obligations_error_on_ambiguity();
if errors.is_empty() {
Ok(Certainty::Yes)
} else if errors.iter().all(|e| !matches!(e, NextSolverError::TrueError(_))) {
diff --git a/crates/hir-ty/src/next_solver/normalize.rs b/crates/hir-ty/src/next_solver/normalize.rs
index 41cb488..2f241f8 100644
--- a/crates/hir-ty/src/next_solver/normalize.rs
+++ b/crates/hir-ty/src/next_solver/normalize.rs
@@ -77,7 +77,7 @@
stalled_coroutine_goals: vec![],
};
let value = value.try_fold_with(&mut folder)?;
- let errors = folder.fulfill_cx.select_all_or_error(at.infcx);
+ let errors = folder.fulfill_cx.evaluate_obligations_error_on_ambiguity(at.infcx);
if errors.is_empty() { Ok((value, folder.stalled_coroutine_goals)) } else { Err(errors) }
}
@@ -138,7 +138,7 @@
fn select_all_and_stall_coroutine_predicates(
&mut self,
) -> Result<(), Vec<NextSolverError<'db>>> {
- let errors = self.fulfill_cx.select_where_possible(self.at.infcx);
+ let errors = self.fulfill_cx.try_evaluate_obligations(self.at.infcx);
if !errors.is_empty() {
return Err(errors);
}
diff --git a/crates/hir-ty/src/next_solver/obligation_ctxt.rs b/crates/hir-ty/src/next_solver/obligation_ctxt.rs
index 8e2dc0d..e85574a 100644
--- a/crates/hir-ty/src/next_solver/obligation_ctxt.rs
+++ b/crates/hir-ty/src/next_solver/obligation_ctxt.rs
@@ -144,13 +144,13 @@
}
#[must_use]
- pub fn select_where_possible(&mut self) -> Vec<NextSolverError<'db>> {
- self.engine.select_where_possible(self.infcx)
+ pub fn try_evaluate_obligations(&mut self) -> Vec<NextSolverError<'db>> {
+ self.engine.try_evaluate_obligations(self.infcx)
}
#[must_use]
- pub fn select_all_or_error(&mut self) -> Vec<NextSolverError<'db>> {
- self.engine.select_all_or_error(self.infcx)
+ pub fn evaluate_obligations_error_on_ambiguity(&mut self) -> Vec<NextSolverError<'db>> {
+ self.engine.evaluate_obligations_error_on_ambiguity(self.infcx)
}
/// Returns the not-yet-processed and stalled obligations from the
diff --git a/crates/hir-ty/src/next_solver/structural_normalize.rs b/crates/hir-ty/src/next_solver/structural_normalize.rs
index 18859d8..00c3708 100644
--- a/crates/hir-ty/src/next_solver/structural_normalize.rs
+++ b/crates/hir-ty/src/next_solver/structural_normalize.rs
@@ -47,7 +47,7 @@
);
fulfill_cx.register_predicate_obligation(self.infcx, obligation);
- let errors = fulfill_cx.select_where_possible(self.infcx);
+ let errors = fulfill_cx.try_evaluate_obligations(self.infcx);
if !errors.is_empty() {
return Err(errors);
}