diff --git a/src/librustc_mir/const_eval/mod.rs b/src/librustc_mir/const_eval/mod.rs index ed992a59839..e7eeb4b4de4 100644 --- a/src/librustc_mir/const_eval/mod.rs +++ b/src/librustc_mir/const_eval/mod.rs @@ -41,7 +41,7 @@ pub(crate) fn destructure_const<'tcx>( ) -> mir::DestructuredConst<'tcx> { trace!("destructure_const: {:?}", val); let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env, false); - let op = ecx.eval_const_to_op(val, None).unwrap(); + let op = ecx.const_to_op(val, None).unwrap(); // We go to `usize` as we cannot allocate anything bigger anyway. let (field_count, variant, down) = match val.ty.kind { diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 0f580b30814..3d3d756cffe 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -848,12 +848,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { }; let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.tcx.span))?; - // Even though `ecx.const_eval` is called from `eval_const_to_op` we can never have a + // Even though `ecx.const_eval` is called from `const_to_op` we can never have a // recursion deeper than one level, because the `tcx.const_eval` above is guaranteed to not - // return `ConstValue::Unevaluated`, which is the only way that `eval_const_to_op` will call + // return `ConstValue::Unevaluated`, which is the only way that `const_to_op` will call // `ecx.const_eval`. let const_ = ty::Const { val: ty::ConstKind::Value(val), ty }; - self.eval_const_to_op(&const_, None) + self.const_to_op(&const_, None) } pub fn const_eval_raw( diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index bb058476823..f9f72464b27 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -517,7 +517,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Constant(ref constant) => { let val = self.subst_from_current_frame_and_normalize_erasing_regions(constant.literal); - self.eval_const_to_op(val, layout)? + self.const_to_op(val, layout)? } }; trace!("{:?}: {:?}", mir_op, *op); @@ -536,7 +536,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // in patterns via the `const_eval` module /// The `val` and `layout` are assumed to already be in our interpreter /// "universe" (param_env). - crate fn eval_const_to_op( + crate fn const_to_op( &self, val: &ty::Const<'tcx>, layout: Option>, @@ -559,16 +559,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // potentially requiring the current static to be evaluated again. This is not a // problem here, because we are building an operand which means an actual read is // happening. - // - // The machine callback `adjust_global_const` below is guaranteed to - // be called for all constants because `const_eval` calls - // `eval_const_to_op` recursively. return Ok(self.const_eval(GlobalId { instance, promoted }, val.ty)?); } ty::ConstKind::Infer(..) | ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(..) => { - span_bug!(self.cur_span(), "eval_const_to_op: Unexpected ConstKind {:?}", val) + span_bug!(self.cur_span(), "const_to_op: Unexpected ConstKind {:?}", val) } ty::ConstKind::Value(val_val) => val_val, }; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 3073bf53afd..59003ce9e76 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -436,7 +436,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { return None; } - match self.ecx.eval_const_to_op(c.literal, None) { + match self.ecx.const_to_op(c.literal, None) { Ok(op) => Some(op), Err(error) => { let tcx = self.ecx.tcx.at(c.span);