@@ -26,10 +26,8 @@ use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
2626use rustc_hir:: def_id:: { DefId , LocalDefId } ;
2727use rustc_hir:: intravisit:: { walk_generics, Visitor as _} ;
2828use rustc_hir:: { GenericArg , GenericArgs , OpaqueTyOrigin } ;
29- use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
3029use rustc_infer:: infer:: { InferCtxt , TyCtxtInferExt } ;
3130use rustc_infer:: traits:: ObligationCause ;
32- use rustc_middle:: infer:: unify_key:: { ConstVariableOrigin , ConstVariableOriginKind } ;
3331use rustc_middle:: middle:: stability:: AllowUnstable ;
3432use rustc_middle:: ty:: fold:: FnMutDelegate ;
3533use rustc_middle:: ty:: subst:: { self , GenericArgKind , InternalSubsts , SubstsRef } ;
@@ -2488,7 +2486,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
24882486 infcx. probe ( |_| {
24892487 let ocx = ObligationCtxt :: new_in_snapshot ( & infcx) ;
24902488
2491- let impl_substs = infcx. fresh_item_substs ( impl_) ;
2489+ let impl_substs = infcx. fresh_substs_for_item ( span , impl_) ;
24922490 let impl_ty = tcx. type_of ( impl_) . subst ( tcx, impl_substs) ;
24932491 let impl_ty = ocx. normalize ( & cause, param_env, impl_ty) ;
24942492
@@ -3775,36 +3773,3 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
37753773 }
37763774 }
37773775}
3778-
3779- pub trait InferCtxtExt < ' tcx > {
3780- fn fresh_item_substs ( & self , def_id : DefId ) -> SubstsRef < ' tcx > ;
3781- }
3782-
3783- impl < ' tcx > InferCtxtExt < ' tcx > for InferCtxt < ' tcx > {
3784- fn fresh_item_substs ( & self , def_id : DefId ) -> SubstsRef < ' tcx > {
3785- InternalSubsts :: for_item ( self . tcx , def_id, |param, _| match param. kind {
3786- GenericParamDefKind :: Lifetime => self . tcx . lifetimes . re_erased . into ( ) ,
3787- GenericParamDefKind :: Type { .. } => self
3788- . next_ty_var ( TypeVariableOrigin {
3789- kind : TypeVariableOriginKind :: SubstitutionPlaceholder ,
3790- span : self . tcx . def_span ( def_id) ,
3791- } )
3792- . into ( ) ,
3793- GenericParamDefKind :: Const { .. } => {
3794- let span = self . tcx . def_span ( def_id) ;
3795- let origin = ConstVariableOrigin {
3796- kind : ConstVariableOriginKind :: SubstitutionPlaceholder ,
3797- span,
3798- } ;
3799- self . next_const_var (
3800- self . tcx
3801- . type_of ( param. def_id )
3802- . no_bound_vars ( )
3803- . expect ( "const parameter types cannot be generic" ) ,
3804- origin,
3805- )
3806- . into ( )
3807- }
3808- } )
3809- }
3810- }
0 commit comments