@@ -140,12 +140,6 @@ impl<'tcx> Const<'tcx> {
140140 }
141141 }
142142
143- /// Interns the given value as a constant.
144- #[ inline]
145- pub fn from_value ( tcx : TyCtxt < ' tcx > , val : ty:: ValTree < ' tcx > , ty : Ty < ' tcx > ) -> Self {
146- tcx. mk_const ( val, ty)
147- }
148-
149143 /// Panics if self.kind != ty::ConstKind::Value
150144 pub fn to_valtree ( self ) -> ty:: ValTree < ' tcx > {
151145 match self . kind ( ) {
@@ -156,7 +150,7 @@ impl<'tcx> Const<'tcx> {
156150
157151 pub fn from_scalar_int ( tcx : TyCtxt < ' tcx > , i : ScalarInt , ty : Ty < ' tcx > ) -> Self {
158152 let valtree = ty:: ValTree :: from_scalar_int ( i) ;
159- Self :: from_value ( tcx, valtree, ty)
153+ tcx. mk_const ( valtree, ty)
160154 }
161155
162156 #[ inline]
@@ -172,8 +166,7 @@ impl<'tcx> Const<'tcx> {
172166 #[ inline]
173167 /// Creates an interned zst constant.
174168 pub fn zero_sized ( tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > ) -> Self {
175- let valtree = ty:: ValTree :: zst ( ) ;
176- Self :: from_value ( tcx, valtree, ty)
169+ tcx. mk_const ( ty:: ValTree :: zst ( ) , ty)
177170 }
178171
179172 #[ inline]
@@ -220,7 +213,7 @@ impl<'tcx> Const<'tcx> {
220213 pub fn eval ( self , tcx : TyCtxt < ' tcx > , param_env : ParamEnv < ' tcx > ) -> Const < ' tcx > {
221214 if let Some ( val) = self . kind ( ) . try_eval_for_typeck ( tcx, param_env) {
222215 match val {
223- Ok ( val) => Const :: from_value ( tcx, val, self . ty ( ) ) ,
216+ Ok ( val) => tcx. mk_const ( val, self . ty ( ) ) ,
224217 Err ( guar) => tcx. const_error_with_guaranteed ( self . ty ( ) , guar) ,
225218 }
226219 } else {
0 commit comments