@@ -26,10 +26,8 @@ use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
26
26
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
27
27
use rustc_hir:: intravisit:: { walk_generics, Visitor as _} ;
28
28
use rustc_hir:: { GenericArg , GenericArgs , OpaqueTyOrigin } ;
29
- use rustc_infer:: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
30
29
use rustc_infer:: infer:: { InferCtxt , TyCtxtInferExt } ;
31
30
use rustc_infer:: traits:: ObligationCause ;
32
- use rustc_middle:: infer:: unify_key:: { ConstVariableOrigin , ConstVariableOriginKind } ;
33
31
use rustc_middle:: middle:: stability:: AllowUnstable ;
34
32
use rustc_middle:: ty:: fold:: FnMutDelegate ;
35
33
use rustc_middle:: ty:: subst:: { self , GenericArgKind , InternalSubsts , SubstsRef } ;
@@ -2488,7 +2486,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2488
2486
infcx. probe ( |_| {
2489
2487
let ocx = ObligationCtxt :: new_in_snapshot ( & infcx) ;
2490
2488
2491
- let impl_substs = infcx. fresh_item_substs ( impl_) ;
2489
+ let impl_substs = infcx. fresh_substs_for_item ( span , impl_) ;
2492
2490
let impl_ty = tcx. type_of ( impl_) . subst ( tcx, impl_substs) ;
2493
2491
let impl_ty = ocx. normalize ( & cause, param_env, impl_ty) ;
2494
2492
@@ -3775,36 +3773,3 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3775
3773
}
3776
3774
}
3777
3775
}
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