From 434c7da6eae28108bf8717977caa330b20b994e1 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 2 Jun 2022 12:12:24 +0200 Subject: [PATCH] only expect lb lt for fn calls in mir typeck --- compiler/rustc_borrowck/src/type_check/mod.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index e5aed1b60dd..e405baf7575 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -20,7 +20,7 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs; use rustc_infer::infer::region_constraints::RegionConstraintData; use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::{ - InferCtxt, InferOk, LateBoundRegionConversionTime, NllRegionVariableOrigin, + InferCtxt, InferOk, LateBoundRegion, LateBoundRegionConversionTime, NllRegionVariableOrigin, }; use rustc_middle::mir::tcx::PlaceTy; use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor}; @@ -1436,11 +1436,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { return; } }; - let (sig, map) = self.infcx.replace_bound_vars_with_fresh_vars( - term.source_info.span, - LateBoundRegionConversionTime::FnCall, - sig, - ); + let (sig, map) = tcx.replace_late_bound_regions(sig, |br| { + self.infcx.next_region_var(LateBoundRegion( + term.source_info.span, + br.kind, + LateBoundRegionConversionTime::FnCall, + )) + }); debug!(?sig); let sig = self.normalize(sig, term_location); self.check_call_dest(body, term, &sig, *destination, target, term_location);