diff options
| author | Ralf Jung <post@ralfj.de> | 2022-11-19 13:41:21 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-11-19 14:08:12 +0100 |
| commit | 3338244f698022611bbc77947f9eb8b5d24d56e5 (patch) | |
| tree | b33afe377d3dfdeb805e42b570f07bdfe214d831 /compiler/rustc_middle/src | |
| parent | becc24a23aed2639db3b78acd93ec6d553898583 (diff) | |
deduplicate constant evaluation in cranelift backend
also sync LLVM and cranelift structure a bit
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/consts.rs | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs index 37153a63944..9a58a196ed7 100644 --- a/compiler/rustc_middle/src/ty/consts.rs +++ b/compiler/rustc_middle/src/ty/consts.rs @@ -1,5 +1,4 @@ use crate::mir::interpret::LitToConstInput; -use crate::mir::ConstantKind; use crate::ty::{self, DefIdTree, InternalSubsts, ParamEnv, ParamEnvAnd, Ty, TyCtxt}; use rustc_data_structures::intern::Interned; use rustc_hir as hir; @@ -231,20 +230,6 @@ impl<'tcx> Const<'tcx> { } #[inline] - /// Tries to evaluate the constant if it is `Unevaluated` and creates a ConstValue if the - /// evaluation succeeds. If it doesn't succeed, returns the unevaluated constant. - pub fn eval_for_mir(self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>) -> ConstantKind<'tcx> { - if let Some(val) = self.kind().try_eval_for_mir(tcx, param_env) { - match val { - Ok(const_val) => ConstantKind::from_value(const_val, self.ty()), - Err(guar) => ConstantKind::Ty(tcx.const_error_with_guaranteed(self.ty(), guar)), - } - } else { - ConstantKind::Ty(self) - } - } - - #[inline] /// Panics if the value cannot be evaluated or doesn't contain a valid integer of the given type. pub fn eval_bits(self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: Ty<'tcx>) -> u128 { self.try_eval_bits(tcx, param_env, ty) |
