Skip to content

Commit c4fbb96

Browse files
authored
Merge pull request #20839 from lnicola/rustc-pull
minor: sync from downstream
2 parents 5e74dc1 + 0ca6ee4 commit c4fbb96

File tree

16 files changed

+62
-58
lines changed

16 files changed

+62
-58
lines changed

Cargo.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8888
vfs = { path = "./crates/vfs", version = "0.0.0" }
8989
edition = { path = "./crates/edition", version = "0.0.0" }
9090

91-
ra-ap-rustc_lexer = { version = "0.132", default-features = false }
92-
ra-ap-rustc_parse_format = { version = "0.132", default-features = false }
93-
ra-ap-rustc_index = { version = "0.132", default-features = false }
94-
ra-ap-rustc_abi = { version = "0.132", default-features = false }
95-
ra-ap-rustc_pattern_analysis = { version = "0.132", default-features = false }
96-
ra-ap-rustc_ast_ir = { version = "0.132", default-features = false }
97-
ra-ap-rustc_type_ir = { version = "0.132", default-features = false }
98-
ra-ap-rustc_next_trait_solver = { version = "0.132", default-features = false }
91+
ra-ap-rustc_lexer = { version = "0.133", default-features = false }
92+
ra-ap-rustc_parse_format = { version = "0.133", default-features = false }
93+
ra-ap-rustc_index = { version = "0.133", default-features = false }
94+
ra-ap-rustc_abi = { version = "0.133", default-features = false }
95+
ra-ap-rustc_pattern_analysis = { version = "0.133", default-features = false }
96+
ra-ap-rustc_ast_ir = { version = "0.133", default-features = false }
97+
ra-ap-rustc_type_ir = { version = "0.133", default-features = false }
98+
ra-ap-rustc_next_trait_solver = { version = "0.133", default-features = false }
9999

100100
# local crates that aren't published to crates.io. These should not have versions.
101101

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(_))) {

0 commit comments

Comments
 (0)