File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,16 @@ impl<'tcx> Const<'tcx> {
163163 self.val.eval(tcx, param_env).try_to_bits(size)
164164 }
165165
166+ #[inline]
167+ pub fn try_eval_bool(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Option<bool> {
168+ self.val.eval(tcx, param_env).try_to_bool()
169+ }
170+
171+ #[inline]
172+ pub fn try_eval_usize(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Option<u64> {
173+ self.val.eval(tcx, param_env).try_to_machine_usize(tcx)
174+ }
175+
166176 #[inline]
167177 /// Tries to evaluate the constant if it is `Unevaluated`. If that doesn't succeed, return the
168178 /// unevaluated constant.
@@ -177,16 +187,6 @@ impl<'tcx> Const<'tcx> {
177187 }
178188 }
179189
180- #[inline]
181- pub fn try_eval_bool(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Option<bool> {
182- self.val.eval(tcx, param_env).try_to_bool()
183- }
184-
185- #[inline]
186- pub fn try_eval_usize(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> Option<u64> {
187- self.val.eval(tcx, param_env).try_to_machine_usize(tcx)
188- }
189-
190190 #[inline]
191191 /// Panics if the value cannot be evaluated or doesn't contain a valid integer of the given type.
192192 pub fn eval_bits(&self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: Ty<'tcx>) -> u128 {
You can’t perform that action at this time.
0 commit comments