@@ -176,8 +176,8 @@ impl<'tcx> CtxtInterners<'tcx> {
176176 }
177177
178178 #[ inline( never) ]
179- fn intern_const ( & self , ty : Ty < ' tcx > , val : ty :: ConstKind < ' tcx > ) -> & ' tcx Const < ' tcx > {
180- self . const_ . intern ( CstHash ( Const { ty , val } ) , |c| Interned ( self . arena . alloc ( c. 0 ) ) ) . 0
179+ fn intern_const ( & self , const_ : Const < ' tcx > ) -> & ' tcx Const < ' tcx > {
180+ self . const_ . intern ( CstHash ( const_ ) , |c| Interned ( self . arena . alloc ( c. 0 ) ) ) . 0
181181 }
182182}
183183
@@ -934,7 +934,7 @@ impl<'tcx> CommonLifetimes<'tcx> {
934934
935935impl < ' tcx > CommonConsts < ' tcx > {
936936 fn new ( interners : & CtxtInterners < ' tcx > , types : & CommonTypes < ' tcx > ) -> CommonConsts < ' tcx > {
937- let mk_const = |ty, val| interners. intern_const ( ty, val) ;
937+ let mk_const = |ty, val| interners. intern_const ( ty:: Const { ty , val } ) ;
938938
939939 CommonConsts {
940940 unit : mk_const ( types. unit , ty:: ConstKind :: Value ( ConstValue :: Scalar ( Scalar :: ZST ) ) ) ,
@@ -2248,7 +2248,13 @@ impl<'tcx> TyCtxt<'tcx> {
22482248
22492249 #[ inline]
22502250 pub fn mk_const ( self , ty : Ty < ' tcx > , val : ty:: ConstKind < ' tcx > ) -> & ' tcx Const < ' tcx > {
2251- self . interners . intern_const ( ty, val)
2251+ self . interners . intern_const ( ty:: Const { ty, val } )
2252+ }
2253+
2254+ /// Same as `mk_const` but interns a constructed `ty::Const` which one might get from decoding the on-disk cache
2255+ #[ inline]
2256+ pub fn mk_const_ ( self , const_ : ty:: Const < ' tcx > ) -> & ' tcx Const < ' tcx > {
2257+ self . interners . intern_const ( const_)
22522258 }
22532259
22542260 #[ inline]
0 commit comments