@@ -17,8 +17,8 @@ use crate::traits;
17
17
use crate :: ty:: query:: { self , TyCtxtAt } ;
18
18
use crate :: ty:: {
19
19
self , AdtDef , AdtDefData , AdtKind , Binder , BindingMode , BoundVar , CanonicalPolyFnSig ,
20
- ClosureSizeProfileData , Const , ConstS , ConstVid , DefIdTree , FloatTy , FloatVar , FloatVid ,
21
- GenericParamDefKind , InferConst , InferTy , IntTy , IntVar , IntVid , List , ParamConst , ParamTy ,
20
+ ClosureSizeProfileData , Const , ConstS , DefIdTree , FloatTy , FloatVar , FloatVid ,
21
+ GenericParamDefKind , InferTy , IntTy , IntVar , IntVid , List , ParamConst , ParamTy ,
22
22
PolyExistentialPredicate , PolyFnSig , Predicate , PredicateKind , PredicateS , ProjectionTy ,
23
23
Region , RegionKind , ReprOptions , TraitObjectVisitor , Ty , TyKind , TyS , TyVar , TyVid , TypeAndMut ,
24
24
UintTy , Visibility ,
@@ -2604,13 +2604,8 @@ impl<'tcx> TyCtxt<'tcx> {
2604
2604
}
2605
2605
2606
2606
#[ inline]
2607
- pub fn mk_const ( self , kind : ty:: ConstKind < ' tcx > , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2608
- self . mk_const_internal ( ty:: ConstS { kind, ty } )
2609
- }
2610
-
2611
- #[ inline]
2612
- pub fn mk_const_var ( self , v : ConstVid < ' tcx > , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2613
- self . mk_const ( ty:: ConstKind :: Infer ( InferConst :: Var ( v) ) , ty)
2607
+ pub fn mk_const ( self , kind : impl Into < ty:: ConstKind < ' tcx > > , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2608
+ self . mk_const_internal ( ty:: ConstS { kind : kind. into ( ) , ty } )
2614
2609
}
2615
2610
2616
2611
#[ inline]
@@ -2628,30 +2623,23 @@ impl<'tcx> TyCtxt<'tcx> {
2628
2623
self . mk_ty ( Infer ( it) )
2629
2624
}
2630
2625
2631
- #[ inline]
2632
- pub fn mk_const_infer ( self , ic : InferConst < ' tcx > , ty : Ty < ' tcx > ) -> ty:: Const < ' tcx > {
2633
- self . mk_const ( ty:: ConstKind :: Infer ( ic) , ty)
2634
- }
2635
-
2636
2626
#[ inline]
2637
2627
pub fn mk_ty_param ( self , index : u32 , name : Symbol ) -> Ty < ' tcx > {
2638
2628
self . mk_ty ( Param ( ParamTy { index, name } ) )
2639
2629
}
2640
2630
2641
- #[ inline]
2642
- pub fn mk_const_param ( self , index : u32 , name : Symbol , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2643
- self . mk_const ( ty:: ConstKind :: Param ( ParamConst { index, name } ) , ty)
2644
- }
2645
-
2646
2631
pub fn mk_param_from_def ( self , param : & ty:: GenericParamDef ) -> GenericArg < ' tcx > {
2647
2632
match param. kind {
2648
2633
GenericParamDefKind :: Lifetime => {
2649
2634
self . mk_region ( ty:: ReEarlyBound ( param. to_early_bound_region_data ( ) ) ) . into ( )
2650
2635
}
2651
2636
GenericParamDefKind :: Type { .. } => self . mk_ty_param ( param. index , param. name ) . into ( ) ,
2652
- GenericParamDefKind :: Const { .. } => {
2653
- self . mk_const_param ( param. index , param. name , self . type_of ( param. def_id ) ) . into ( )
2654
- }
2637
+ GenericParamDefKind :: Const { .. } => self
2638
+ . mk_const (
2639
+ ParamConst { index : param. index , name : param. name } ,
2640
+ self . type_of ( param. def_id ) ,
2641
+ )
2642
+ . into ( ) ,
2655
2643
}
2656
2644
}
2657
2645
0 commit comments