Skip to content

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),

compiler/rustc_typeck/src/check/expr.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
561561
// placeholder lifetimes with probing, we just replace higher lifetimes
562562
// with fresh vars.
563563
let span = args.get(i).map(|a| a.span).unwrap_or(expr.span);
564-
let input = self
565-
.replace_bound_vars_with_fresh_vars(
566-
span,
567-
infer::LateBoundRegionConversionTime::FnCall,
568-
fn_sig.input(i),
569-
)
570-
.0;
564+
let input = self.replace_bound_vars_with_fresh_vars(
565+
span,
566+
infer::LateBoundRegionConversionTime::FnCall,
567+
fn_sig.input(i),
568+
);
571569
self.require_type_is_sized_deferred(
572570
input,
573571
span,
@@ -581,13 +579,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
581579
// Also, as we just want to check sizedness, instead of introducing
582580
// placeholder lifetimes with probing, we just replace higher lifetimes
583581
// with fresh vars.
584-
let output = self
585-
.replace_bound_vars_with_fresh_vars(
586-
expr.span,
587-
infer::LateBoundRegionConversionTime::FnCall,
588-
fn_sig.output(),
589-
)
590-
.0;
582+
let output = self.replace_bound_vars_with_fresh_vars(
583+
expr.span,
584+
infer::LateBoundRegionConversionTime::FnCall,
585+
fn_sig.output(),
586+
);
591587
self.require_type_is_sized_deferred(output, expr.span, traits::SizedReturnType);
592588
}
593589

compiler/rustc_typeck/src/check/fn_ctxt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
256256
item_segment: &hir::PathSegment<'_>,
257257
poly_trait_ref: ty::PolyTraitRef<'tcx>,
258258
) -> Ty<'tcx> {
259-
let (trait_ref, _) = self.replace_bound_vars_with_fresh_vars(
259+
let trait_ref = self.replace_bound_vars_with_fresh_vars(
260260
span,
261261
infer::LateBoundRegionConversionTime::AssocTypeProjection(item_def_id),
262262
poly_trait_ref,

compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8585
_ => return false,
8686
};
8787

88-
let sig = self.replace_bound_vars_with_fresh_vars(expr.span, infer::FnCall, sig).0;
88+
let sig = self.replace_bound_vars_with_fresh_vars(expr.span, infer::FnCall, sig);
8989
let sig = self.normalize_associated_types_in(expr.span, sig);
9090
if self.can_coerce(sig.output(), expected) {
9191
let (mut sugg_call, applicability) = if sig.inputs().is_empty() {

compiler/rustc_typeck/src/check/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
574574
where
575575
T: TypeFoldable<'tcx>,
576576
{
577-
self.fcx.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, value).0
577+
self.fcx.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, value)
578578
}
579579
}

compiler/rustc_typeck/src/check/method/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
462462
// may reference those regions.
463463
let fn_sig = tcx.bound_fn_sig(def_id);
464464
let fn_sig = fn_sig.subst(self.tcx, substs);
465-
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, fn_sig).0;
465+
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, fn_sig);
466466

467467
let InferOk { value, obligations: o } = if is_op {
468468
self.normalize_op_associated_types_in_as_infer_ok(span, fn_sig, opt_input_expr)

compiler/rustc_typeck/src/check/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
905905
self.probe(|_| {
906906
let substs = self.fresh_substs_for_item(self.span, method.def_id);
907907
let fty = fty.subst(self.tcx, substs);
908-
let (fty, _) =
908+
let fty =
909909
self.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, fty);
910910

911911
if let Some(self_ty) = self_ty {

0 commit comments

Comments
 (0)