diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-08 18:32:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-08 18:32:44 +0100 |
| commit | ec65285fdd4b702f58df467ab9f6d2daffe9a2be (patch) | |
| tree | 55859e6d1f1ab72d5160ff2fe72ed4c6599c1fa3 /compiler/rustc_trait_selection/src/solve | |
| parent | 5b8403c46357ee0f1e72aa6b7ab90942d697a241 (diff) | |
| parent | 03a8a4ff3e7cf0633ceaf0a5fa8d347cfe49e809 (diff) | |
| download | rust-ec65285fdd4b702f58df467ab9f6d2daffe9a2be.tar.gz rust-ec65285fdd4b702f58df467ab9f6d2daffe9a2be.zip | |
Rollup merge of #107780 - compiler-errors:instantiate-binder, r=lcnr
Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*` Mentioning "binder" rather than "bound vars", imo, makes it clearer that we're doing something to the binder as a whole. Also, "instantiate" is the verb that I'm always reaching for when I'm looking for these functions, and the name that we use in the new solver anyways. r? types
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
6 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs index a2c15123b4f..c1936b7dbe4 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs @@ -74,7 +74,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { ) } ty::PredicateKind::Subtype(pred) => { - let (a, b) = infcx.replace_bound_vars_with_placeholders( + let (a, b) = infcx.instantiate_binder_with_placeholders( goal.predicate.kind().rebind((pred.a, pred.b)), ); let expected_found = ExpectedFound::new(true, a, b); @@ -84,7 +84,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { ) } ty::PredicateKind::Coerce(pred) => { - let (a, b) = infcx.replace_bound_vars_with_placeholders( + let (a, b) = infcx.instantiate_binder_with_placeholders( goal.predicate.kind().rebind((pred.a, pred.b)), ); let expected_found = ExpectedFound::new(false, a, b); @@ -94,7 +94,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> { ) } ty::PredicateKind::ConstEquate(a, b) => { - let (a, b) = infcx.replace_bound_vars_with_placeholders( + let (a, b) = infcx.instantiate_binder_with_placeholders( goal.predicate.kind().rebind((a, b)), ); let expected_found = ExpectedFound::new(true, a, b); diff --git a/compiler/rustc_trait_selection/src/solve/infcx_ext.rs b/compiler/rustc_trait_selection/src/solve/infcx_ext.rs index 42f597c781d..36f987c9f9c 100644 --- a/compiler/rustc_trait_selection/src/solve/infcx_ext.rs +++ b/compiler/rustc_trait_selection/src/solve/infcx_ext.rs @@ -26,7 +26,7 @@ pub(super) trait InferCtxtExt<'tcx> { rhs: T, ) -> Result<Vec<Goal<'tcx, ty::Predicate<'tcx>>>, NoSolution>; - fn instantiate_bound_vars_with_infer<T: TypeFoldable<'tcx> + Copy>( + fn instantiate_binder_with_infer<T: TypeFoldable<'tcx> + Copy>( &self, value: ty::Binder<'tcx, T>, ) -> T; @@ -65,11 +65,11 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { }) } - fn instantiate_bound_vars_with_infer<T: TypeFoldable<'tcx> + Copy>( + fn instantiate_binder_with_infer<T: TypeFoldable<'tcx> + Copy>( &self, value: ty::Binder<'tcx, T>, ) -> T { - self.replace_bound_vars_with_fresh_vars( + self.instantiate_binder_with_fresh_vars( DUMMY_SP, LateBoundRegionConversionTime::HigherRankedType, value, diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs index e4725c0a1b7..9f092b6018f 100644 --- a/compiler/rustc_trait_selection/src/solve/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/mod.rs @@ -304,7 +304,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { } } } else { - let kind = self.infcx.replace_bound_vars_with_placeholders(kind); + let kind = self.infcx.instantiate_binder_with_placeholders(kind); let goal = goal.with(self.tcx(), ty::Binder::dummy(kind)); let (_, certainty) = self.evaluate_goal(goal)?; self.make_canonical_response(certainty) diff --git a/compiler/rustc_trait_selection/src/solve/project_goals.rs b/compiler/rustc_trait_selection/src/solve/project_goals.rs index f9acf7a53ee..e3ec71d1b4f 100644 --- a/compiler/rustc_trait_selection/src/solve/project_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/project_goals.rs @@ -323,7 +323,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> { { ecx.infcx.probe(|_| { let assumption_projection_pred = - ecx.infcx.instantiate_bound_vars_with_infer(poly_projection_pred); + ecx.infcx.instantiate_binder_with_infer(poly_projection_pred); let nested_goals = ecx.infcx.eq( goal.param_env, goal.predicate.projection_ty, diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 1cf1efc9704..06a72e95d49 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -72,7 +72,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { // FIXME: Constness and polarity ecx.infcx.probe(|_| { let assumption_trait_pred = - ecx.infcx.instantiate_bound_vars_with_infer(poly_trait_pred); + ecx.infcx.instantiate_binder_with_infer(poly_trait_pred); let nested_goals = ecx.infcx.eq( goal.param_env, goal.predicate.trait_ref, diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals/structural_traits.rs b/compiler/rustc_trait_selection/src/solve/trait_goals/structural_traits.rs index 5007a019e18..1ee35a86e62 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals/structural_traits.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals/structural_traits.rs @@ -54,7 +54,7 @@ pub(super) fn instantiate_constituent_tys_for_auto_trait<'tcx>( } ty::GeneratorWitness(types) => { - Ok(infcx.replace_bound_vars_with_placeholders(types).to_vec()) + Ok(infcx.instantiate_binder_with_placeholders(types).to_vec()) } ty::GeneratorWitnessMIR(..) => todo!(), @@ -174,7 +174,7 @@ pub(super) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>( } ty::GeneratorWitness(types) => { - Ok(infcx.replace_bound_vars_with_placeholders(types).to_vec()) + Ok(infcx.instantiate_binder_with_placeholders(types).to_vec()) } ty::GeneratorWitnessMIR(..) => todo!(), |
