Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cc013e0

Browse files
committed
bound_vars -> infer: don't return lt map
1 parent 543ca7d commit cc013e0

File tree

16 files changed

+40
-54
lines changed

16 files changed

+40
-54
lines changed

compiler/rustc_borrowck/src/type_check/input_output.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
6060
// Replace the bound items in the fn sig with fresh
6161
// variables, so that they represent the view from
6262
// "inside" the closure.
63-
self.infcx
64-
.replace_bound_vars_with_fresh_vars(
65-
body.span,
66-
LateBoundRegionConversionTime::FnCall,
67-
poly_sig,
68-
)
69-
.0
63+
self.infcx.replace_bound_vars_with_fresh_vars(
64+
body.span,
65+
LateBoundRegionConversionTime::FnCall,
66+
poly_sig,
67+
)
7068
},
7169
);
7270
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
3838
// with a fresh region variable. These region variables --
3939
// but no other pre-existing region variables -- can name
4040
// the placeholders.
41-
let (a_prime, _) =
42-
self.infcx.replace_bound_vars_with_fresh_vars(span, HigherRankedType, a);
41+
let a_prime = self.infcx.replace_bound_vars_with_fresh_vars(span, HigherRankedType, a);
4342

4443
debug!("a_prime={:?}", a_prime);
4544
debug!("b_prime={:?}", b_prime);

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
15241524
span: Span,
15251525
lbrct: LateBoundRegionConversionTime,
15261526
value: ty::Binder<'tcx, T>,
1527-
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
1527+
) -> T
15281528
where
15291529
T: TypeFoldable<'tcx>,
15301530
{
@@ -1553,8 +1553,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
15531553
)
15541554
})
15551555
};
1556-
let result = self.tcx.replace_bound_vars_uncached(value, fld_r, fld_t, fld_c);
1557-
(result, region_map)
1556+
self.tcx.replace_bound_vars_uncached(value, fld_r, fld_t, fld_c)
15581557
}
15591558

15601559
/// See the [`region_constraints::RegionConstraintCollector::verify_generic_bound`] method.

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
15361536
let bound_predicate = predicate.kind();
15371537
if let ty::PredicateKind::Projection(data) = bound_predicate.skip_binder() {
15381538
let mut selcx = SelectionContext::new(self);
1539-
let (data, _) = self.replace_bound_vars_with_fresh_vars(
1539+
let data = self.replace_bound_vars_with_fresh_vars(
15401540
obligation.cause.span,
15411541
infer::LateBoundRegionConversionTime::HigherRankedType,
15421542
bound_predicate.rebind(data),

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ fn confirm_param_env_candidate<'cx, 'tcx>(
19201920
let cause = &obligation.cause;
19211921
let param_env = obligation.param_env;
19221922

1923-
let (cache_entry, _) = infcx.replace_bound_vars_with_fresh_vars(
1923+
let cache_entry = infcx.replace_bound_vars_with_fresh_vars(
19241924
cause.span,
19251925
LateBoundRegionConversionTime::HigherRankedType,
19261926
poly_cache_entry,

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
421421
let object_trait_ref = data.principal().unwrap_or_else(|| {
422422
span_bug!(obligation.cause.span, "object candidate with no principal")
423423
});
424-
let object_trait_ref = self
425-
.infcx
426-
.replace_bound_vars_with_fresh_vars(
427-
obligation.cause.span,
428-
HigherRankedType,
429-
object_trait_ref,
430-
)
431-
.0;
424+
let object_trait_ref = self.infcx.replace_bound_vars_with_fresh_vars(
425+
obligation.cause.span,
426+
HigherRankedType,
427+
object_trait_ref,
428+
);
432429
let object_trait_ref = object_trait_ref.with_self_ty(self.tcx(), self_ty);
433430

434431
let mut nested = vec![];

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
14531453
potentially_unnormalized_candidates: bool,
14541454
) -> ProjectionMatchesProjection {
14551455
let mut nested_obligations = Vec::new();
1456-
let (infer_predicate, _) = self.infcx.replace_bound_vars_with_fresh_vars(
1456+
let infer_predicate = self.infcx.replace_bound_vars_with_fresh_vars(
14571457
obligation.cause.span,
14581458
LateBoundRegionConversionTime::HigherRankedType,
14591459
env_predicate,

compiler/rustc_typeck/src/check/callee.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
152152
// fnmut vs fnonce. If so, we have to defer further processing.
153153
if self.closure_kind(substs).is_none() {
154154
let closure_sig = substs.as_closure().sig();
155-
let closure_sig = self
156-
.replace_bound_vars_with_fresh_vars(
157-
call_expr.span,
158-
infer::FnCall,
159-
closure_sig,
160-
)
161-
.0;
155+
let closure_sig = self.replace_bound_vars_with_fresh_vars(
156+
call_expr.span,
157+
infer::FnCall,
158+
closure_sig,
159+
);
162160
let adjustments = self.adjust_steps(autoderef);
163161
self.record_deferred_call_resolution(
164162
def_id,
@@ -503,8 +501,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
503501
// renormalize the associated types at this point, since they
504502
// previously appeared within a `Binder<>` and hence would not
505503
// have been normalized before.
506-
let fn_sig =
507-
self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, fn_sig).0;
504+
let fn_sig = self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, fn_sig);
508505
let fn_sig = self.normalize_associated_types_in(call_expr.span, fn_sig);
509506

510507
// Call the generic checker.

compiler/rustc_typeck/src/check/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
550550
expected_sigs.liberated_sig.inputs(), // `liberated_sig` is E'.
551551
) {
552552
// Instantiate (this part of..) S to S', i.e., with fresh variables.
553-
let (supplied_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
553+
let supplied_ty = self.infcx.replace_bound_vars_with_fresh_vars(
554554
hir_ty.span,
555555
LateBoundRegionConversionTime::FnCall,
556556
supplied_sig.inputs().rebind(supplied_ty),
@@ -563,7 +563,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
563563
all_obligations.extend(obligations);
564564
}
565565

566-
let (supplied_output_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
566+
let supplied_output_ty = self.infcx.replace_bound_vars_with_fresh_vars(
567567
decl.output.span(),
568568
LateBoundRegionConversionTime::FnCall,
569569
supplied_sig.output(),

compiler/rustc_typeck/src/check/compare_method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn compare_predicate_entailment<'tcx>(
255255

256256
let mut wf_tys = FxHashSet::default();
257257

258-
let (impl_sig, _) = infcx.replace_bound_vars_with_fresh_vars(
258+
let impl_sig = infcx.replace_bound_vars_with_fresh_vars(
259259
impl_m_span,
260260
infer::HigherRankedType,
261261
tcx.fn_sig(impl_m.def_id),

0 commit comments

Comments
 (0)