@@ -176,8 +176,8 @@ impl<'tcx> CtxtInterners<'tcx> {
176
176
}
177
177
178
178
#[ 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
181
181
}
182
182
}
183
183
@@ -934,7 +934,7 @@ impl<'tcx> CommonLifetimes<'tcx> {
934
934
935
935
impl < ' tcx > CommonConsts < ' tcx > {
936
936
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 } ) ;
938
938
939
939
CommonConsts {
940
940
unit : mk_const ( types. unit , ty:: ConstKind :: Value ( ConstValue :: Scalar ( Scalar :: ZST ) ) ) ,
@@ -2248,7 +2248,13 @@ impl<'tcx> TyCtxt<'tcx> {
2248
2248
2249
2249
#[ inline]
2250
2250
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_)
2252
2258
}
2253
2259
2254
2260
#[ inline]
0 commit comments