Skip to content

Commit 44254c8

Browse files
Remove some glob imports from the type system
1 parent 2801f9a commit 44254c8

File tree

32 files changed

+243
-185
lines changed

32 files changed

+243
-185
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir::def::Res::Def;
1010
use rustc_hir::def_id::DefId;
1111
use rustc_hir::intravisit::VisitorExt;
1212
use rustc_hir::{PolyTraitRef, TyKind, WhereBoundPredicate};
13-
use rustc_infer::infer::{NllRegionVariableOrigin, RelateParamBound};
13+
use rustc_infer::infer::{NllRegionVariableOrigin, SubregionOrigin};
1414
use rustc_middle::bug;
1515
use rustc_middle::hir::place::PlaceBase;
1616
use rustc_middle::mir::{AnnotationSource, ConstraintCategory, ReturnConstraint};
@@ -329,7 +329,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
329329
self.infcx.tcx,
330330
type_test.generic_kind.to_ty(self.infcx.tcx),
331331
);
332-
let origin = RelateParamBound(type_test_span, generic_ty, None);
332+
let origin =
333+
SubregionOrigin::RelateParamBound(type_test_span, generic_ty, None);
333334
self.buffer_error(self.infcx.err_ctxt().construct_generic_bound_failure(
334335
self.body.source.def_id().expect_local(),
335336
type_test_span,

compiler/rustc_borrowck/src/type_check/constraint_conversion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
33
use rustc_infer::infer::outlives::env::RegionBoundPairs;
44
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
55
use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
6-
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
6+
use rustc_infer::infer::{InferCtxt, SubregionOrigin};
77
use rustc_infer::traits::query::type_op::DeeplyNormalize;
88
use rustc_middle::bug;
99
use rustc_middle::ty::{
@@ -172,7 +172,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
172172
ty::Region::new_var(tcx, universal_regions.implicit_region_bound());
173173
// we don't actually use this for anything, but
174174
// the `TypeOutlives` code needs an origin.
175-
let origin = infer::RelateParamBound(self.span, t1, None);
175+
let origin = SubregionOrigin::RelateParamBound(self.span, t1, None);
176176
TypeOutlives::new(
177177
&mut *self,
178178
tcx,

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
1616
use rustc_infer::infer::outlives::env::RegionBoundPairs;
1717
use rustc_infer::infer::region_constraints::RegionConstraintData;
1818
use rustc_infer::infer::{
19-
BoundRegion, BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin,
19+
BoundRegionConversionTime, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin,
2020
};
2121
use rustc_infer::traits::PredicateObligations;
2222
use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
@@ -794,7 +794,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
794794
};
795795

796796
self.infcx.next_region_var(
797-
BoundRegion(
797+
RegionVariableOrigin::BoundRegion(
798798
term.source_info.span,
799799
br.kind,
800800
BoundRegionConversionTime::FnCall,

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan, pluralize, struct_
99
use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::intravisit::VisitorExt;
1111
use rustc_hir::{self as hir, AmbigArg, GenericParamKind, ImplItemKind, intravisit};
12-
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
12+
use rustc_infer::infer::{self, BoundRegionConversionTime, InferCtxt, TyCtxtInferExt};
1313
use rustc_infer::traits::util;
1414
use rustc_middle::ty::error::{ExpectedFound, TypeError};
1515
use rustc_middle::ty::{
@@ -311,7 +311,7 @@ fn compare_method_predicate_entailment<'tcx>(
311311

312312
let unnormalized_impl_sig = infcx.instantiate_binder_with_fresh_vars(
313313
impl_m_span,
314-
infer::HigherRankedType,
314+
BoundRegionConversionTime::HigherRankedType,
315315
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
316316
);
317317

@@ -518,7 +518,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
518518
param_env,
519519
infcx.instantiate_binder_with_fresh_vars(
520520
return_span,
521-
infer::HigherRankedType,
521+
BoundRegionConversionTime::HigherRankedType,
522522
tcx.fn_sig(impl_m.def_id).instantiate_identity(),
523523
),
524524
);

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
1111
use rustc_hir::lang_items::LangItem;
1212
use rustc_hir::{AmbigArg, ItemKind};
1313
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
14-
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
14+
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin, TyCtxtInferExt};
1515
use rustc_lint_defs::builtin::SUPERTRAIT_ITEM_SHADOWING_DEFINITION;
1616
use rustc_macros::LintDiagnostic;
1717
use rustc_middle::mir::interpret::ErrorHandled;
@@ -739,7 +739,7 @@ fn ty_known_to_outlive<'tcx>(
739739
infcx.register_type_outlives_constraint_inner(infer::TypeOutlivesConstraint {
740740
sub_region: region,
741741
sup_type: ty,
742-
origin: infer::RelateParamBound(DUMMY_SP, ty, None),
742+
origin: SubregionOrigin::RelateParamBound(DUMMY_SP, ty, None),
743743
});
744744
})
745745
}
@@ -755,7 +755,11 @@ fn region_known_to_outlive<'tcx>(
755755
region_b: ty::Region<'tcx>,
756756
) -> bool {
757757
test_region_obligations(tcx, id, param_env, wf_tys, |infcx| {
758-
infcx.sub_regions(infer::RelateRegionParamBound(DUMMY_SP, None), region_b, region_a);
758+
infcx.sub_regions(
759+
SubregionOrigin::RelateRegionParamBound(DUMMY_SP, None),
760+
region_b,
761+
region_a,
762+
);
759763
})
760764
}
761765

compiler/rustc_hir_analysis/src/coherence/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir as hir;
1010
use rustc_hir::ItemKind;
1111
use rustc_hir::def_id::{DefId, LocalDefId};
1212
use rustc_hir::lang_items::LangItem;
13-
use rustc_infer::infer::{self, RegionResolutionError, TyCtxtInferExt};
13+
use rustc_infer::infer::{self, RegionResolutionError, SubregionOrigin, TyCtxtInferExt};
1414
use rustc_infer::traits::Obligation;
1515
use rustc_middle::ty::adjustment::CoerceUnsizedInfo;
1616
use rustc_middle::ty::print::PrintTraitRefExt as _;
@@ -415,7 +415,7 @@ pub(crate) fn coerce_unsized_info<'tcx>(
415415
};
416416
let (source, target, trait_def_id, kind, field_span) = match (source.kind(), target.kind()) {
417417
(&ty::Ref(r_a, ty_a, mutbl_a), &ty::Ref(r_b, ty_b, mutbl_b)) => {
418-
infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a);
418+
infcx.sub_regions(SubregionOrigin::RelateObjectBound(span), r_b, r_a);
419419
let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a };
420420
let mt_b = ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b };
421421
check_mutbl(mt_a, mt_b, &|ty| Ty::new_imm_ref(tcx, r_b, ty))

compiler/rustc_hir_typeck/src/callee.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hir::def::{self, CtorKind, Namespace, Res};
77
use rustc_hir::def_id::DefId;
88
use rustc_hir::{self as hir, HirId, LangItem};
99
use rustc_hir_analysis::autoderef::Autoderef;
10-
use rustc_infer::infer;
10+
use rustc_infer::infer::BoundRegionConversionTime;
1111
use rustc_infer::traits::{Obligation, ObligationCause, ObligationCauseCode};
1212
use rustc_middle::ty::adjustment::{
1313
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability,
@@ -219,7 +219,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
219219
let closure_sig = args.as_closure().sig();
220220
let closure_sig = self.instantiate_binder_with_fresh_vars(
221221
call_expr.span,
222-
infer::FnCall,
222+
BoundRegionConversionTime::FnCall,
223223
closure_sig,
224224
);
225225
let adjustments = self.adjust_steps(autoderef);
@@ -246,7 +246,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
246246
let closure_args = args.as_coroutine_closure();
247247
let coroutine_closure_sig = self.instantiate_binder_with_fresh_vars(
248248
call_expr.span,
249-
infer::FnCall,
249+
BoundRegionConversionTime::FnCall,
250250
closure_args.coroutine_closure_sig(),
251251
);
252252
let tupled_upvars_ty = self.next_ty_var(callee_expr.span);
@@ -545,7 +545,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
545545
// renormalize the associated types at this point, since they
546546
// previously appeared within a `Binder<>` and hence would not
547547
// have been normalized before.
548-
let fn_sig = self.instantiate_binder_with_fresh_vars(call_expr.span, infer::FnCall, fn_sig);
548+
let fn_sig = self.instantiate_binder_with_fresh_vars(
549+
call_expr.span,
550+
BoundRegionConversionTime::FnCall,
551+
fn_sig,
552+
);
549553
let fn_sig = self.normalize(call_expr.span, fn_sig);
550554

551555
self.check_argument_types(

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use rustc_hir as hir;
4444
use rustc_hir::def_id::{DefId, LocalDefId};
4545
use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer;
4646
use rustc_infer::infer::relate::RelateResult;
47-
use rustc_infer::infer::{Coercion, DefineOpaqueTypes, InferOk, InferResult};
47+
use rustc_infer::infer::{DefineOpaqueTypes, InferOk, InferResult, RegionVariableOrigin};
4848
use rustc_infer::traits::{
4949
IfExpressionCause, MatchExpressionArmCause, Obligation, PredicateObligation,
5050
PredicateObligations, SelectionError,
@@ -431,7 +431,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
431431
} else {
432432
if r_borrow_var.is_none() {
433433
// create var lazily, at most once
434-
let coercion = Coercion(span);
434+
let coercion = RegionVariableOrigin::Coercion(span);
435435
let r = self.next_region_var(coercion);
436436
r_borrow_var = Some(r); // [4] above
437437
}
@@ -549,7 +549,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
549549
(&ty::Ref(_, ty_a, mutbl_a), &ty::Ref(_, _, mutbl_b)) => {
550550
coerce_mutbls(mutbl_a, mutbl_b)?;
551551

552-
let coercion = Coercion(self.cause.span);
552+
let coercion = RegionVariableOrigin::Coercion(self.cause.span);
553553
let r_borrow = self.next_region_var(coercion);
554554

555555
// We don't allow two-phase borrows here, at least for initial
@@ -672,7 +672,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
672672
return Err(TypeError::Mismatch);
673673
}
674674
}
675-
Err(traits::Unimplemented) => {
675+
Err(SelectionError::Unimplemented) => {
676676
debug!("coerce_unsized: early return - can't prove obligation");
677677
return Err(TypeError::Mismatch);
678678
}

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use rustc_hir::lang_items::LangItem;
2222
use rustc_hir::{ExprKind, HirId, QPath};
2323
use rustc_hir_analysis::NoVariantNamed;
2424
use rustc_hir_analysis::hir_ty_lowering::{FeedConstTy, HirTyLowerer as _};
25-
use rustc_infer::infer;
26-
use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
25+
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk, RegionVariableOrigin};
2726
use rustc_infer::traits::query::NoSolution;
2827
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase};
2928
use rustc_middle::ty::error::{ExpectedFound, TypeError};
@@ -705,7 +704,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
705704
// this time with enough precision to check that the value
706705
// whose address was taken can actually be made to live as long
707706
// as it needs to live.
708-
let region = self.next_region_var(infer::BorrowRegion(expr.span));
707+
let region = self.next_region_var(RegionVariableOrigin::BorrowRegion(expr.span));
709708
match kind {
710709
hir::BorrowKind::Ref => Ty::new_ref(self.tcx, region, ty, mutbl),
711710
hir::BorrowKind::Pin => Ty::new_pinned_ref(self.tcx, region, ty, mutbl),

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_hir::{ExprKind, HirId, LangItem, Node, QPath};
1111
use rustc_hir_analysis::check::potentially_plural_count;
1212
use rustc_hir_analysis::hir_ty_lowering::{HirTyLowerer, PermitVariants};
1313
use rustc_index::IndexVec;
14-
use rustc_infer::infer::{DefineOpaqueTypes, InferOk, TypeTrace};
14+
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TypeTrace};
1515
use rustc_middle::ty::adjustment::AllowTwoPhase;
1616
use rustc_middle::ty::error::TypeError;
1717
use rustc_middle::ty::{self, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
@@ -30,7 +30,6 @@ use crate::TupleArgumentsFlag::*;
3030
use crate::coercion::CoerceMany;
3131
use crate::errors::SuggestPtrNullMut;
3232
use crate::fn_ctxt::arg_matrix::{ArgMatrix, Compatibility, Error, ExpectedIdx, ProvidedIdx};
33-
use crate::fn_ctxt::infer::FnCall;
3433
use crate::gather_locals::Declaration;
3534
use crate::inline_asm::InlineAsmCtxt;
3635
use crate::method::probe::IsSuggestion;
@@ -657,7 +656,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
657656
let args = self.infcx.fresh_args_for_item(call_name.span, assoc.def_id);
658657
let fn_sig = tcx.fn_sig(assoc.def_id).instantiate(tcx, args);
659658

660-
self.instantiate_binder_with_fresh_vars(call_name.span, FnCall, fn_sig);
659+
self.instantiate_binder_with_fresh_vars(
660+
call_name.span,
661+
BoundRegionConversionTime::FnCall,
662+
fn_sig,
663+
);
661664
}
662665
None
663666
};

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_hir::{self as hir, HirId, ItemLocalMap};
1515
use rustc_hir_analysis::hir_ty_lowering::{
1616
HirTyLowerer, InherentAssocCandidate, RegionInferReason,
1717
};
18-
use rustc_infer::infer;
18+
use rustc_infer::infer::{self, RegionVariableOrigin};
1919
use rustc_infer::traits::{DynCompatibilityViolation, Obligation};
2020
use rustc_middle::ty::{self, Const, Ty, TyCtxt, TypeVisitableExt};
2121
use rustc_session::Session;
@@ -244,8 +244,10 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
244244

245245
fn re_infer(&self, span: Span, reason: RegionInferReason<'_>) -> ty::Region<'tcx> {
246246
let v = match reason {
247-
RegionInferReason::Param(def) => infer::RegionParameterDefinition(span, def.name),
248-
_ => infer::MiscVariable(span),
247+
RegionInferReason::Param(def) => {
248+
RegionVariableOrigin::RegionParameterDefinition(span, def.name)
249+
}
250+
_ => RegionVariableOrigin::MiscVariable(span),
249251
};
250252
self.next_region_var(v)
251253
}

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use rustc_hir_analysis::hir_ty_lowering::generics::{
99
use rustc_hir_analysis::hir_ty_lowering::{
1010
FeedConstTy, GenericArgsLowerer, HirTyLowerer, IsMethodCall, RegionInferReason,
1111
};
12-
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk};
12+
use rustc_infer::infer::{
13+
BoundRegionConversionTime, DefineOpaqueTypes, InferOk, RegionVariableOrigin,
14+
};
1315
use rustc_lint::builtin::SUPERTRAIT_ITEM_SHADOWING_USAGE;
1416
use rustc_middle::traits::ObligationCauseCode;
1517
use rustc_middle::ty::adjustment::{
@@ -194,7 +196,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
194196

195197
match pick.autoref_or_ptr_adjustment {
196198
Some(probe::AutorefOrPtrAdjustment::Autoref { mutbl, unsize }) => {
197-
let region = self.next_region_var(infer::Autoref(self.span));
199+
let region = self.next_region_var(RegionVariableOrigin::Autoref(self.span));
198200
// Type we're wrapping in a reference, used later for unsizing
199201
let base_ty = target;
200202

@@ -239,7 +241,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
239241
}
240242

241243
Some(probe::AutorefOrPtrAdjustment::ReborrowPin(mutbl)) => {
242-
let region = self.next_region_var(infer::Autoref(self.span));
244+
let region = self.next_region_var(RegionVariableOrigin::Autoref(self.span));
243245

244246
target = match target.kind() {
245247
ty::Adt(pin, args) if self.tcx.is_lang_item(pin.did(), hir::LangItem::Pin) => {
@@ -752,6 +754,10 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
752754
where
753755
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
754756
{
755-
self.fcx.instantiate_binder_with_fresh_vars(self.span, infer::FnCall, value)
757+
self.fcx.instantiate_binder_with_fresh_vars(
758+
self.span,
759+
BoundRegionConversionTime::FnCall,
760+
value,
761+
)
756762
}
757763
}

compiler/rustc_hir_typeck/src/method/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_errors::{Applicability, Diag, SubdiagMessage};
1111
use rustc_hir as hir;
1212
use rustc_hir::def::{CtorOf, DefKind, Namespace};
1313
use rustc_hir::def_id::DefId;
14-
use rustc_infer::infer::{self, InferOk};
14+
use rustc_infer::infer::{BoundRegionConversionTime, InferOk};
1515
use rustc_infer::traits::PredicateObligations;
1616
use rustc_middle::query::Providers;
1717
use rustc_middle::traits::ObligationCause;
@@ -400,8 +400,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
400400
// function signature so that normalization does not need to deal
401401
// with bound regions.
402402
let fn_sig = tcx.fn_sig(def_id).instantiate(self.tcx, args);
403-
let fn_sig =
404-
self.instantiate_binder_with_fresh_vars(obligation.cause.span, infer::FnCall, fn_sig);
403+
let fn_sig = self.instantiate_binder_with_fresh_vars(
404+
obligation.cause.span,
405+
BoundRegionConversionTime::FnCall,
406+
fn_sig,
407+
);
405408

406409
let InferOk { value: fn_sig, obligations: o } =
407410
self.at(&obligation.cause, self.param_env).normalize(fn_sig);

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_hir::HirId;
1212
use rustc_hir::def::DefKind;
1313
use rustc_hir_analysis::autoderef::{self, Autoderef};
1414
use rustc_infer::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse};
15-
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk, TyCtxtInferExt};
15+
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TyCtxtInferExt};
1616
use rustc_infer::traits::ObligationCauseCode;
1717
use rustc_middle::middle::stability;
1818
use rustc_middle::query::Providers;
@@ -995,7 +995,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
995995
ty::AssocKind::Fn { .. } => self.probe(|_| {
996996
let args = self.fresh_args_for_item(self.span, method.def_id);
997997
let fty = self.tcx.fn_sig(method.def_id).instantiate(self.tcx, args);
998-
let fty = self.instantiate_binder_with_fresh_vars(self.span, infer::FnCall, fty);
998+
let fty = self.instantiate_binder_with_fresh_vars(
999+
self.span,
1000+
BoundRegionConversionTime::FnCall,
1001+
fty,
1002+
);
9991003
self.can_eq(self.param_env, fty.output(), expected)
10001004
}),
10011005
_ => false,
@@ -1756,8 +1760,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
17561760
CandidateSource::Trait(candidate.item.container_id(self.tcx))
17571761
}
17581762
TraitCandidate(trait_ref) => self.probe(|_| {
1759-
let trait_ref =
1760-
self.instantiate_binder_with_fresh_vars(self.span, infer::FnCall, trait_ref);
1763+
let trait_ref = self.instantiate_binder_with_fresh_vars(
1764+
self.span,
1765+
BoundRegionConversionTime::FnCall,
1766+
trait_ref,
1767+
);
17611768
let (xform_self_ty, _) =
17621769
self.xform_self_ty(candidate.item, trait_ref.self_ty(), trait_ref.args);
17631770
// Guide the trait selection to show impls that have methods whose type matches
@@ -1873,7 +1880,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
18731880

18741881
let trait_ref = self.instantiate_binder_with_fresh_vars(
18751882
self.span,
1876-
infer::FnCall,
1883+
BoundRegionConversionTime::FnCall,
18771884
poly_trait_ref,
18781885
);
18791886
let trait_ref = ocx.normalize(cause, self.param_env, trait_ref);
@@ -1936,7 +1943,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
19361943
ObjectCandidate(poly_trait_ref) | WhereClauseCandidate(poly_trait_ref) => {
19371944
let trait_ref = self.instantiate_binder_with_fresh_vars(
19381945
self.span,
1939-
infer::FnCall,
1946+
BoundRegionConversionTime::FnCall,
19401947
poly_trait_ref,
19411948
);
19421949
(xform_self_ty, xform_ret_ty) =

0 commit comments

Comments
 (0)