@@ -1316,7 +1316,7 @@ impl<'tcx> TyCtxt<'tcx> {
1316
1316
msg : & str ,
1317
1317
) -> Const < ' tcx > {
1318
1318
let reported = self . sess . delay_span_bug ( span, msg) ;
1319
- self . mk_const ( ty:: ConstS { kind : ty :: ConstKind :: Error ( reported) , ty } )
1319
+ self . mk_const ( ty:: ConstKind :: Error ( reported) , ty)
1320
1320
}
1321
1321
1322
1322
pub fn consider_optimizing < T : Fn ( ) -> String > ( self , msg : T ) -> bool {
@@ -2231,7 +2231,7 @@ macro_rules! direct_interners {
2231
2231
2232
2232
direct_interners ! {
2233
2233
region: mk_region( RegionKind <' tcx>) : Region -> Region <' tcx>,
2234
- const_: mk_const ( ConstS <' tcx>) : Const -> Const <' tcx>,
2234
+ const_: mk_const_internal ( ConstS <' tcx>) : Const -> Const <' tcx>,
2235
2235
const_allocation: intern_const_alloc( Allocation ) : ConstAllocation -> ConstAllocation <' tcx>,
2236
2236
layout: intern_layout( LayoutS <' tcx>) : Layout -> Layout <' tcx>,
2237
2237
adt_def: intern_adt_def( AdtDefData ) : AdtDef -> AdtDef <' tcx>,
@@ -2569,9 +2569,14 @@ impl<'tcx> TyCtxt<'tcx> {
2569
2569
self . mk_ty_infer ( TyVar ( v) )
2570
2570
}
2571
2571
2572
+ #[ inline]
2573
+ pub fn mk_const ( self , kind : ty:: ConstKind < ' tcx > , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2574
+ self . mk_const_internal ( ty:: ConstS { kind, ty } )
2575
+ }
2576
+
2572
2577
#[ inline]
2573
2578
pub fn mk_const_var ( self , v : ConstVid < ' tcx > , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2574
- self . mk_const ( ty:: ConstS { kind : ty :: ConstKind :: Infer ( InferConst :: Var ( v) ) , ty } )
2579
+ self . mk_const ( ty:: ConstKind :: Infer ( InferConst :: Var ( v) ) , ty)
2575
2580
}
2576
2581
2577
2582
#[ inline]
@@ -2591,7 +2596,7 @@ impl<'tcx> TyCtxt<'tcx> {
2591
2596
2592
2597
#[ inline]
2593
2598
pub fn mk_const_infer ( self , ic : InferConst < ' tcx > , ty : Ty < ' tcx > ) -> ty:: Const < ' tcx > {
2594
- self . mk_const ( ty:: ConstS { kind : ty :: ConstKind :: Infer ( ic) , ty } )
2599
+ self . mk_const ( ty:: ConstKind :: Infer ( ic) , ty)
2595
2600
}
2596
2601
2597
2602
#[ inline]
@@ -2601,7 +2606,7 @@ impl<'tcx> TyCtxt<'tcx> {
2601
2606
2602
2607
#[ inline]
2603
2608
pub fn mk_const_param ( self , index : u32 , name : Symbol , ty : Ty < ' tcx > ) -> Const < ' tcx > {
2604
- self . mk_const ( ty:: ConstS { kind : ty :: ConstKind :: Param ( ParamConst { index, name } ) , ty } )
2609
+ self . mk_const ( ty:: ConstKind :: Param ( ParamConst { index, name } ) , ty)
2605
2610
}
2606
2611
2607
2612
pub fn mk_param_from_def ( self , param : & ty:: GenericParamDef ) -> GenericArg < ' tcx > {
0 commit comments