Skip to content

Commit a01c123

Browse files
committed
Merge ref 'fb24b04b096a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: fb24b04 Filtered ref: 8d328b9 Upstream diff: rust-lang/rust@3369e82...fb24b04 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents 9d0b861 + 8d328b9 commit a01c123

File tree

13 files changed

+31
-27
lines changed

13 files changed

+31
-27
lines changed

crates/hir-ty/src/autoderef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ fn structurally_normalize_ty<'db>(
327327
// evaluate/fulfill mismatches, but that's not a reason for an ICE.
328328
return None;
329329
};
330-
let errors = ocx.select_where_possible();
330+
let errors = ocx.try_evaluate_obligations();
331331
if !errors.is_empty() {
332332
unreachable!();
333333
}

crates/hir-ty/src/infer/coerce.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl<'a, 'b, 'db> Coerce<'a, 'b, 'db> {
160160
Ok(InferOk { value, obligations }) => {
161161
let mut ocx = ObligationCtxt::new(this.infer_ctxt());
162162
ocx.register_obligations(obligations);
163-
if ocx.select_where_possible().is_empty() {
163+
if ocx.try_evaluate_obligations().is_empty() {
164164
Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
165165
} else {
166166
Err(TypeError::Mismatch)
@@ -722,7 +722,7 @@ impl<'a, 'b, 'db> Coerce<'a, 'b, 'db> {
722722
Some(PredicateKind::AliasRelate(..)) => {
723723
let mut ocx = ObligationCtxt::new(self.infer_ctxt());
724724
ocx.register_obligation(obligation);
725-
if !ocx.select_where_possible().is_empty() {
725+
if !ocx.try_evaluate_obligations().is_empty() {
726726
return Err(TypeError::Mismatch);
727727
}
728728
coercion.obligations.extend(ocx.into_pending_obligations());
@@ -1093,7 +1093,7 @@ impl<'db> InferenceContext<'_, 'db> {
10931093
prev_ty,
10941094
new_ty,
10951095
)?;
1096-
if ocx.select_where_possible().is_empty() {
1096+
if ocx.try_evaluate_obligations().is_empty() {
10971097
Ok(InferOk { value, obligations: ocx.into_pending_obligations() })
10981098
} else {
10991099
Err(TypeError::Mismatch)

crates/hir-ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ impl<'db> InferenceContext<'_, 'db> {
20232023
// No argument expectations are produced if unification fails.
20242024
let origin = ObligationCause::new();
20252025
ocx.sup(&origin, self.table.trait_env.env, expected_output, formal_output)?;
2026-
if !ocx.select_where_possible().is_empty() {
2026+
if !ocx.try_evaluate_obligations().is_empty() {
20272027
return Err(TypeError::Mismatch);
20282028
}
20292029

crates/hir-ty/src/infer/unify.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn could_unify<'db>(
117117
env: Arc<TraitEnvironment<'db>>,
118118
tys: &Canonical<'db, (Ty<'db>, Ty<'db>)>,
119119
) -> bool {
120-
could_unify_impl(db, env, tys, |ctxt| ctxt.select_where_possible())
120+
could_unify_impl(db, env, tys, |ctxt| ctxt.try_evaluate_obligations())
121121
}
122122

123123
/// Check if types unify eagerly making sure there are no unresolved goals.
@@ -129,7 +129,7 @@ pub fn could_unify_deeply<'db>(
129129
env: Arc<TraitEnvironment<'db>>,
130130
tys: &Canonical<'db, (Ty<'db>, Ty<'db>)>,
131131
) -> bool {
132-
could_unify_impl(db, env, tys, |ctxt| ctxt.select_all_or_error())
132+
could_unify_impl(db, env, tys, |ctxt| ctxt.evaluate_obligations_error_on_ambiguity())
133133
}
134134

135135
fn could_unify_impl<'db>(
@@ -608,7 +608,7 @@ impl<'db> InferenceTable<'db> {
608608
}
609609

610610
pub(crate) fn select_obligations_where_possible(&mut self) {
611-
self.fulfillment_cx.select_where_possible(&self.infer_ctxt);
611+
self.fulfillment_cx.try_evaluate_obligations(&self.infer_ctxt);
612612
}
613613

614614
pub(super) fn register_predicate(&mut self, obligation: PredicateObligation<'db>) {

crates/hir-ty/src/method_resolution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ pub(crate) fn find_matching_impl<'db>(
822822
let mut ocx = ObligationCtxt::new(infcx);
823823
let impl_source = selection.map(|obligation| ocx.register_obligation(obligation));
824824

825-
let errors = ocx.select_all_or_error();
825+
let errors = ocx.evaluate_obligations_error_on_ambiguity();
826826
if !errors.is_empty() {
827827
return None;
828828
}
@@ -1663,7 +1663,7 @@ fn is_valid_trait_method_candidate<'db>(
16631663
let mut ctxt = ObligationCtxt::new(&table.infer_ctxt);
16641664
ctxt.register_obligations(infer_ok.into_obligations());
16651665
// FIXME: Are we doing this correctly? Probably better to follow rustc more closely.
1666-
check_that!(ctxt.select_where_possible().is_empty());
1666+
check_that!(ctxt.try_evaluate_obligations().is_empty());
16671667
}
16681668

16691669
check_that!(table.unify(receiver_ty, expected_receiver));
@@ -1743,7 +1743,7 @@ fn is_valid_impl_fn_candidate<'db>(
17431743
)
17441744
}));
17451745

1746-
if ctxt.select_where_possible().is_empty() {
1746+
if ctxt.try_evaluate_obligations().is_empty() {
17471747
IsValidCandidate::Yes
17481748
} else {
17491749
IsValidCandidate::No

crates/hir-ty/src/next_solver/fulfill.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct ObligationStorage<'db> {
5454
/// Obligations which resulted in an overflow in fulfillment itself.
5555
///
5656
/// We cannot eagerly return these as error so we instead store them here
57-
/// to avoid recomputing them each time `select_where_possible` is called.
57+
/// to avoid recomputing them each time `try_evaluate_obligations` is called.
5858
/// This also allows us to return the correct `FulfillmentError` for them.
5959
overflowed: Vec<PredicateObligation<'db>>,
6060
pending: PendingObligations<'db>,
@@ -95,7 +95,7 @@ impl<'db> ObligationStorage<'db> {
9595
// IMPORTANT: we must not use solve any inference variables in the obligations
9696
// as this is all happening inside of a probe. We use a probe to make sure
9797
// we get all obligations involved in the overflow. We pretty much check: if
98-
// we were to do another step of `select_where_possible`, which goals would
98+
// we were to do another step of `try_evaluate_obligations`, which goals would
9999
// change.
100100
// FIXME: <https://github.com/Gankra/thin-vec/pull/66> is merged, this can be removed.
101101
self.overflowed.extend(
@@ -131,7 +131,7 @@ impl<'db> FulfillmentCtxt<'db> {
131131
infcx: &InferCtxt<'db>,
132132
obligation: PredicateObligation<'db>,
133133
) {
134-
// FIXME: See the comment in `select_where_possible()`.
134+
// FIXME: See the comment in `try_evaluate_obligations()`.
135135
// assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
136136
self.obligations.register(obligation, None);
137137
}
@@ -141,7 +141,7 @@ impl<'db> FulfillmentCtxt<'db> {
141141
infcx: &InferCtxt<'db>,
142142
obligations: impl IntoIterator<Item = PredicateObligation<'db>>,
143143
) {
144-
// FIXME: See the comment in `select_where_possible()`.
144+
// FIXME: See the comment in `try_evaluate_obligations()`.
145145
// assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
146146
obligations.into_iter().for_each(|obligation| self.obligations.register(obligation, None));
147147
}
@@ -158,7 +158,7 @@ impl<'db> FulfillmentCtxt<'db> {
158158
.collect()
159159
}
160160

161-
pub(crate) fn select_where_possible(
161+
pub(crate) fn try_evaluate_obligations(
162162
&mut self,
163163
infcx: &InferCtxt<'db>,
164164
) -> Vec<NextSolverError<'db>> {
@@ -223,11 +223,11 @@ impl<'db> FulfillmentCtxt<'db> {
223223
errors
224224
}
225225

226-
pub(crate) fn select_all_or_error(
226+
pub(crate) fn evaluate_obligations_error_on_ambiguity(
227227
&mut self,
228228
infcx: &InferCtxt<'db>,
229229
) -> Vec<NextSolverError<'db>> {
230-
let errors = self.select_where_possible(infcx);
230+
let errors = self.try_evaluate_obligations(infcx);
231231
if !errors.is_empty() {
232232
return errors;
233233
}

crates/hir-ty/src/next_solver/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ impl<'db> InferCtxt<'db> {
464464
let mut ocx = ObligationCtxt::new(self);
465465
ocx.register_obligation(obligation.clone());
466466
let mut result = EvaluationResult::EvaluatedToOk;
467-
for error in ocx.select_all_or_error() {
467+
for error in ocx.evaluate_obligations_error_on_ambiguity() {
468468
if error.is_true_error() {
469469
return EvaluationResult::EvaluatedToErr;
470470
} else {

crates/hir-ty/src/next_solver/inspect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<'db> NormalizesToTermHack<'db> {
9292
let mut ocx = ObligationCtxt::new(infcx);
9393
ocx.eq(&ObligationCause::dummy(), param_env, self.term, self.unconstrained_term)?;
9494
f(&mut ocx);
95-
let errors = ocx.select_all_or_error();
95+
let errors = ocx.evaluate_obligations_error_on_ambiguity();
9696
if errors.is_empty() {
9797
Ok(Certainty::Yes)
9898
} else if errors.iter().all(|e| !matches!(e, NextSolverError::TrueError(_))) {

crates/hir-ty/src/next_solver/normalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ where
7777
stalled_coroutine_goals: vec![],
7878
};
7979
let value = value.try_fold_with(&mut folder)?;
80-
let errors = folder.fulfill_cx.select_all_or_error(at.infcx);
80+
let errors = folder.fulfill_cx.evaluate_obligations_error_on_ambiguity(at.infcx);
8181
if errors.is_empty() { Ok((value, folder.stalled_coroutine_goals)) } else { Err(errors) }
8282
}
8383

@@ -138,7 +138,7 @@ impl<'db> NormalizationFolder<'_, 'db> {
138138
fn select_all_and_stall_coroutine_predicates(
139139
&mut self,
140140
) -> Result<(), Vec<NextSolverError<'db>>> {
141-
let errors = self.fulfill_cx.select_where_possible(self.at.infcx);
141+
let errors = self.fulfill_cx.try_evaluate_obligations(self.at.infcx);
142142
if !errors.is_empty() {
143143
return Err(errors);
144144
}

crates/hir-ty/src/next_solver/obligation_ctxt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ impl<'a, 'db> ObligationCtxt<'a, 'db> {
144144
}
145145

146146
#[must_use]
147-
pub fn select_where_possible(&mut self) -> Vec<NextSolverError<'db>> {
148-
self.engine.select_where_possible(self.infcx)
147+
pub fn try_evaluate_obligations(&mut self) -> Vec<NextSolverError<'db>> {
148+
self.engine.try_evaluate_obligations(self.infcx)
149149
}
150150

151151
#[must_use]
152-
pub fn select_all_or_error(&mut self) -> Vec<NextSolverError<'db>> {
153-
self.engine.select_all_or_error(self.infcx)
152+
pub fn evaluate_obligations_error_on_ambiguity(&mut self) -> Vec<NextSolverError<'db>> {
153+
self.engine.evaluate_obligations_error_on_ambiguity(self.infcx)
154154
}
155155

156156
/// Returns the not-yet-processed and stalled obligations from the

0 commit comments

Comments
 (0)