1
Fork 0

bound_vars -> infer: don't return lt map

This commit is contained in:
lcnr 2022-06-02 12:48:56 +02:00
parent 543ca7d9e7
commit cc013e05b4
16 changed files with 40 additions and 54 deletions

View file

@ -152,13 +152,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// fnmut vs fnonce. If so, we have to defer further processing.
if self.closure_kind(substs).is_none() {
let closure_sig = substs.as_closure().sig();
let closure_sig = self
.replace_bound_vars_with_fresh_vars(
call_expr.span,
infer::FnCall,
closure_sig,
)
.0;
let closure_sig = self.replace_bound_vars_with_fresh_vars(
call_expr.span,
infer::FnCall,
closure_sig,
);
let adjustments = self.adjust_steps(autoderef);
self.record_deferred_call_resolution(
def_id,
@ -503,8 +501,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// renormalize the associated types at this point, since they
// previously appeared within a `Binder<>` and hence would not
// have been normalized before.
let fn_sig =
self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, fn_sig).0;
let fn_sig = self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, fn_sig);
let fn_sig = self.normalize_associated_types_in(call_expr.span, fn_sig);
// Call the generic checker.

View file

@ -550,7 +550,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected_sigs.liberated_sig.inputs(), // `liberated_sig` is E'.
) {
// Instantiate (this part of..) S to S', i.e., with fresh variables.
let (supplied_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
let supplied_ty = self.infcx.replace_bound_vars_with_fresh_vars(
hir_ty.span,
LateBoundRegionConversionTime::FnCall,
supplied_sig.inputs().rebind(supplied_ty),
@ -563,7 +563,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
all_obligations.extend(obligations);
}
let (supplied_output_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
let supplied_output_ty = self.infcx.replace_bound_vars_with_fresh_vars(
decl.output.span(),
LateBoundRegionConversionTime::FnCall,
supplied_sig.output(),

View file

@ -255,7 +255,7 @@ fn compare_predicate_entailment<'tcx>(
let mut wf_tys = FxHashSet::default();
let (impl_sig, _) = infcx.replace_bound_vars_with_fresh_vars(
let impl_sig = infcx.replace_bound_vars_with_fresh_vars(
impl_m_span,
infer::HigherRankedType,
tcx.fn_sig(impl_m.def_id),

View file

@ -561,13 +561,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// placeholder lifetimes with probing, we just replace higher lifetimes
// with fresh vars.
let span = args.get(i).map(|a| a.span).unwrap_or(expr.span);
let input = self
.replace_bound_vars_with_fresh_vars(
span,
infer::LateBoundRegionConversionTime::FnCall,
fn_sig.input(i),
)
.0;
let input = self.replace_bound_vars_with_fresh_vars(
span,
infer::LateBoundRegionConversionTime::FnCall,
fn_sig.input(i),
);
self.require_type_is_sized_deferred(
input,
span,
@ -581,13 +579,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Also, as we just want to check sizedness, instead of introducing
// placeholder lifetimes with probing, we just replace higher lifetimes
// with fresh vars.
let output = self
.replace_bound_vars_with_fresh_vars(
expr.span,
infer::LateBoundRegionConversionTime::FnCall,
fn_sig.output(),
)
.0;
let output = self.replace_bound_vars_with_fresh_vars(
expr.span,
infer::LateBoundRegionConversionTime::FnCall,
fn_sig.output(),
);
self.require_type_is_sized_deferred(output, expr.span, traits::SizedReturnType);
}

View file

@ -256,7 +256,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
item_segment: &hir::PathSegment<'_>,
poly_trait_ref: ty::PolyTraitRef<'tcx>,
) -> Ty<'tcx> {
let (trait_ref, _) = self.replace_bound_vars_with_fresh_vars(
let trait_ref = self.replace_bound_vars_with_fresh_vars(
span,
infer::LateBoundRegionConversionTime::AssocTypeProjection(item_def_id),
poly_trait_ref,

View file

@ -85,7 +85,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => return false,
};
let sig = self.replace_bound_vars_with_fresh_vars(expr.span, infer::FnCall, sig).0;
let sig = self.replace_bound_vars_with_fresh_vars(expr.span, infer::FnCall, sig);
let sig = self.normalize_associated_types_in(expr.span, sig);
if self.can_coerce(sig.output(), expected) {
let (mut sugg_call, applicability) = if sig.inputs().is_empty() {

View file

@ -574,6 +574,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
where
T: TypeFoldable<'tcx>,
{
self.fcx.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, value).0
self.fcx.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, value)
}
}

View file

@ -462,7 +462,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// may reference those regions.
let fn_sig = tcx.bound_fn_sig(def_id);
let fn_sig = fn_sig.subst(self.tcx, substs);
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, fn_sig).0;
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, fn_sig);
let InferOk { value, obligations: o } = if is_op {
self.normalize_op_associated_types_in_as_infer_ok(span, fn_sig, opt_input_expr)

View file

@ -905,7 +905,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
self.probe(|_| {
let substs = self.fresh_substs_for_item(self.span, method.def_id);
let fty = fty.subst(self.tcx, substs);
let (fty, _) =
let fty =
self.replace_bound_vars_with_fresh_vars(self.span, infer::FnCall, fty);
if let Some(self_ty) = self_ty {