Skip to content

Commit e34e344

Browse files
committed
rename instantiate_canonical_with_fresh_inference_vars
1 parent 8124b26 commit e34e344

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

compiler/rustc_borrowck/src/type_check/canonical.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6161
Ok(output)
6262
}
6363

64-
pub(super) fn instantiate_canonical_with_fresh_inference_vars<T>(
64+
pub(super) fn instantiate_canonical<T>(
6565
&mut self,
6666
span: Span,
6767
canonical: &Canonical<'tcx, T>,
6868
) -> T
6969
where
7070
T: TypeFoldable<TyCtxt<'tcx>>,
7171
{
72-
let (instantiated, _) =
73-
self.infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical);
72+
let (instantiated, _) = self.infcx.instantiate_canonical(span, canonical);
7473
instantiated
7574
}
7675

compiler/rustc_borrowck/src/type_check/input_output.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
3939
// (e.g., the `_` in the code above) with fresh variables.
4040
// Then replace the bound items in the fn sig with fresh variables,
4141
// so that they represent the view from "inside" the closure.
42-
let user_provided_sig = self
43-
.instantiate_canonical_with_fresh_inference_vars(body.span, &user_provided_poly_sig);
42+
let user_provided_sig = self.instantiate_canonical(body.span, &user_provided_poly_sig);
4443
let mut user_provided_sig = self.infcx.instantiate_binder_with_fresh_vars(
4544
body.span,
4645
BoundRegionConversionTime::FnCall,

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11091109
let tcx = self.tcx();
11101110
for user_annotation in self.user_type_annotations {
11111111
let CanonicalUserTypeAnnotation { span, ref user_ty, inferred_ty } = *user_annotation;
1112-
let annotation = self.instantiate_canonical_with_fresh_inference_vars(span, user_ty);
1112+
let annotation = self.instantiate_canonical(span, user_ty);
11131113
if let ty::UserType::TypeOf(def, args) = annotation
11141114
&& let DefKind::InlineConst = tcx.def_kind(def)
11151115
{

compiler/rustc_hir_typeck/src/method/probe.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
386386

387387
let infcx = &self.infcx;
388388
let (ParamEnvAnd { param_env: _, value: self_ty }, canonical_inference_vars) =
389-
infcx.instantiate_canonical_with_fresh_inference_vars(
390-
span,
391-
&param_env_and_self_ty,
392-
);
389+
infcx.instantiate_canonical(span, &param_env_and_self_ty);
393390
debug!(
394391
"probe_op: Mode::Path, param_env_and_self_ty={:?} self_ty={:?}",
395392
param_env_and_self_ty, self_ty
@@ -661,13 +658,13 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
661658
// of the iterations in the autoderef loop, so there is no problem with it
662659
// being discoverable in another one of these iterations.
663660
//
664-
// Using `instantiate_canonical_with_fresh_inference_vars` on our
661+
// Using `instantiate_canonical` on our
665662
// `Canonical<QueryResponse<Ty<'tcx>>>` and then *throwing away* the
666663
// `CanonicalVarValues` will exactly give us such a generalization - it
667664
// will still match the original object type, but it won't pollute our
668665
// type variables in any form, so just do that!
669666
let (QueryResponse { value: generalized_self_ty, .. }, _ignored_var_values) =
670-
self.fcx.instantiate_canonical_with_fresh_inference_vars(self.span, self_ty);
667+
self.fcx.instantiate_canonical(self.span, self_ty);
671668

672669
self.assemble_inherent_candidates_from_object(generalized_self_ty);
673670
self.assemble_inherent_impl_candidates_for_type(p.def_id());

compiler/rustc_infer/src/infer/canonical/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ mod instantiate;
3838
pub mod query_response;
3939

4040
impl<'tcx> InferCtxt<'tcx> {
41-
/// Creates an instantiation S for the canonical value with fresh
42-
/// inference variables and applies it to the canonical value.
41+
/// Creates an instantiation S for the canonical value with fresh inference
42+
/// variables and placeholders then applies it to the canonical value.
4343
/// Returns both the instantiated result *and* the instantiation S.
4444
///
4545
/// This can be invoked as part of constructing an
@@ -50,7 +50,7 @@ impl<'tcx> InferCtxt<'tcx> {
5050
/// At the end of processing, the instantiation S (once
5151
/// canonicalized) then represents the values that you computed
5252
/// for each of the canonical inputs to your query.
53-
pub fn instantiate_canonical_with_fresh_inference_vars<T>(
53+
pub fn instantiate_canonical<T>(
5454
&self,
5555
span: Span,
5656
canonical: &Canonical<'tcx, T>,

compiler/rustc_infer/src/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
678678
T: TypeFoldable<TyCtxt<'tcx>>,
679679
{
680680
let infcx = self.build();
681-
let (value, args) = infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical);
681+
let (value, args) = infcx.instantiate_canonical(span, canonical);
682682
(infcx, value, args)
683683
}
684684

0 commit comments

Comments
 (0)