Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | crates/hir-ty/src/autoderef.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/infer/coerce.rs | 6 | ||||
| -rw-r--r-- | crates/hir-ty/src/infer/expr.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/infer/unify.rs | 6 | ||||
| -rw-r--r-- | crates/hir-ty/src/method_resolution.rs | 6 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/fulfill.rs | 14 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/infer/mod.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/inspect.rs | 2 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/normalize.rs | 4 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/obligation_ctxt.rs | 8 | ||||
| -rw-r--r-- | crates/hir-ty/src/next_solver/structural_normalize.rs | 2 | ||||
| -rw-r--r-- | crates/ide-db/src/imports/merge_imports.rs | 2 | ||||
| -rw-r--r-- | crates/test-fixture/src/lib.rs | 2 |
13 files changed, 31 insertions, 27 deletions
diff --git a/crates/hir-ty/src/autoderef.rs b/crates/hir-ty/src/autoderef.rs index abd1b8b155..6dd3cdb745 100644 --- a/crates/hir-ty/src/autoderef.rs +++ b/crates/hir-ty/src/autoderef.rs @@ -327,7 +327,7 @@ fn structurally_normalize_ty<'db>( // 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 ce5c98979d..4620da7147 100644 --- a/crates/hir-ty/src/infer/coerce.rs +++ b/crates/hir-ty/src/infer/coerce.rs @@ -160,7 +160,7 @@ impl<'a, 'b, 'db> Coerce<'a, 'b, 'db> { 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) @@ -722,7 +722,7 @@ impl<'a, 'b, 'db> Coerce<'a, 'b, 'db> { 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()); @@ -1093,7 +1093,7 @@ impl<'db> InferenceContext<'_, 'db> { 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 859dfef70f..179eaccc65 100644 --- a/crates/hir-ty/src/infer/expr.rs +++ b/crates/hir-ty/src/infer/expr.rs @@ -2023,7 +2023,7 @@ impl<'db> InferenceContext<'_, 'db> { // No argument expectations are produced if unification fails. let origin = ObligationCause::new(); ocx.sup(&origin, self.table.trait_env.env, expected_output, formal_output)?; - if !ocx.select_where_possible().is_empty() { + if !ocx.try_evaluate_obligations().is_empty() { return Err(TypeError::Mismatch); } diff --git a/crates/hir-ty/src/infer/unify.rs b/crates/hir-ty/src/infer/unify.rs index 114c90c7be..8f754f0e1a 100644 --- a/crates/hir-ty/src/infer/unify.rs +++ b/crates/hir-ty/src/infer/unify.rs @@ -117,7 +117,7 @@ pub fn could_unify<'db>( env: Arc<TraitEnvironment<'db>>, tys: &Canonical<'db, (Ty<'db>, Ty<'db>)>, ) -> bool { - could_unify_impl(db, env, tys, |ctxt| ctxt.select_where_possible()) + could_unify_impl(db, env, tys, |ctxt| ctxt.try_evaluate_obligations()) } /// Check if types unify eagerly making sure there are no unresolved goals. @@ -129,7 +129,7 @@ pub fn could_unify_deeply<'db>( env: Arc<TraitEnvironment<'db>>, tys: &Canonical<'db, (Ty<'db>, Ty<'db>)>, ) -> bool { - could_unify_impl(db, env, tys, |ctxt| ctxt.select_all_or_error()) + could_unify_impl(db, env, tys, |ctxt| ctxt.evaluate_obligations_error_on_ambiguity()) } fn could_unify_impl<'db>( @@ -608,7 +608,7 @@ impl<'db> InferenceTable<'db> { } 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(&mut self, obligation: PredicateObligation<'db>) { diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs index 98c8f3e890..06c7cdd4e4 100644 --- a/crates/hir-ty/src/method_resolution.rs +++ b/crates/hir-ty/src/method_resolution.rs @@ -822,7 +822,7 @@ pub(crate) fn find_matching_impl<'db>( let mut ocx = ObligationCtxt::new(infcx); let impl_source = selection.map(|obligation| ocx.register_obligation(obligation)); - let errors = ocx.select_all_or_error(); + let errors = ocx.evaluate_obligations_error_on_ambiguity(); if !errors.is_empty() { return None; } @@ -1663,7 +1663,7 @@ fn is_valid_trait_method_candidate<'db>( 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)); @@ -1743,7 +1743,7 @@ fn is_valid_impl_fn_candidate<'db>( ) })); - 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 34dff37972..262da858d4 100644 --- a/crates/hir-ty/src/next_solver/fulfill.rs +++ b/crates/hir-ty/src/next_solver/fulfill.rs @@ -54,7 +54,7 @@ struct ObligationStorage<'db> { /// 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 @@ impl<'db> ObligationStorage<'db> { // 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 @@ impl<'db> FulfillmentCtxt<'db> { 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 @@ impl<'db> FulfillmentCtxt<'db> { 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 @@ impl<'db> FulfillmentCtxt<'db> { .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 @@ impl<'db> FulfillmentCtxt<'db> { 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/infer/mod.rs b/crates/hir-ty/src/next_solver/infer/mod.rs index 1bb6934e07..e1a46fa069 100644 --- a/crates/hir-ty/src/next_solver/infer/mod.rs +++ b/crates/hir-ty/src/next_solver/infer/mod.rs @@ -464,7 +464,7 @@ impl<'db> InferCtxt<'db> { let mut ocx = ObligationCtxt::new(self); ocx.register_obligation(obligation.clone()); let mut result = EvaluationResult::EvaluatedToOk; - for error in ocx.select_all_or_error() { + for error in ocx.evaluate_obligations_error_on_ambiguity() { if error.is_true_error() { return EvaluationResult::EvaluatedToErr; } else { diff --git a/crates/hir-ty/src/next_solver/inspect.rs b/crates/hir-ty/src/next_solver/inspect.rs index bc19d51d23..0db4746721 100644 --- a/crates/hir-ty/src/next_solver/inspect.rs +++ b/crates/hir-ty/src/next_solver/inspect.rs @@ -92,7 +92,7 @@ impl<'db> NormalizesToTermHack<'db> { 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 41cb488440..2f241f8fec 100644 --- a/crates/hir-ty/src/next_solver/normalize.rs +++ b/crates/hir-ty/src/next_solver/normalize.rs @@ -77,7 +77,7 @@ where 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 @@ impl<'db> NormalizationFolder<'_, 'db> { 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 8e2dc0dec4..e85574a882 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 @@ impl<'a, 'db> ObligationCtxt<'a, 'db> { } #[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 18859d8b79..00c3708358 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 @@ impl<'db> At<'_, 'db> { ); 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); } diff --git a/crates/ide-db/src/imports/merge_imports.rs b/crates/ide-db/src/imports/merge_imports.rs index 4e779a7d85..635ed7368c 100644 --- a/crates/ide-db/src/imports/merge_imports.rs +++ b/crates/ide-db/src/imports/merge_imports.rs @@ -405,6 +405,8 @@ fn recursive_normalize(use_tree: &ast::UseTree, style: NormalizationStyle) -> Op } else { ted::replace_with_many(subtree.syntax(), elements); } + // Silence unused assignment warning on `modified`. + let _ = modified; modified = true; } else { modified |= recursive_normalize(&subtree, NormalizationStyle::Default).is_some(); diff --git a/crates/test-fixture/src/lib.rs b/crates/test-fixture/src/lib.rs index 7574d12c0c..a4549794db 100644 --- a/crates/test-fixture/src/lib.rs +++ b/crates/test-fixture/src/lib.rs @@ -383,6 +383,8 @@ impl ChangeFixture { } } + let _ = file_id; + let root = match current_source_root_kind { SourceRootKind::Local => SourceRoot::new_local(mem::take(&mut file_set)), SourceRootKind::Library => SourceRoot::new_library(mem::take(&mut file_set)), |