Skip to content

Commit b8fd0f6

Browse files
committed
rename eval_const_to_op -> const_to_op
1 parent 1df9f44 commit b8fd0f6

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

src/librustc_mir/const_eval/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) fn destructure_const<'tcx>(
4141
) -> mir::DestructuredConst<'tcx> {
4242
trace!("destructure_const: {:?}", val);
4343
let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env, false);
44-
let op = ecx.eval_const_to_op(val, None).unwrap();
44+
let op = ecx.const_to_op(val, None).unwrap();
4545

4646
// We go to `usize` as we cannot allocate anything bigger anyway.
4747
let (field_count, variant, down) = match val.ty.kind {

src/librustc_mir/interpret/eval_context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
848848
};
849849
let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.tcx.span))?;
850850

851-
// Even though `ecx.const_eval` is called from `eval_const_to_op` we can never have a
851+
// Even though `ecx.const_eval` is called from `const_to_op` we can never have a
852852
// recursion deeper than one level, because the `tcx.const_eval` above is guaranteed to not
853-
// return `ConstValue::Unevaluated`, which is the only way that `eval_const_to_op` will call
853+
// return `ConstValue::Unevaluated`, which is the only way that `const_to_op` will call
854854
// `ecx.const_eval`.
855855
let const_ = ty::Const { val: ty::ConstKind::Value(val), ty };
856-
self.eval_const_to_op(&const_, None)
856+
self.const_to_op(&const_, None)
857857
}
858858

859859
pub fn const_eval_raw(

src/librustc_mir/interpret/operand.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
517517
Constant(ref constant) => {
518518
let val =
519519
self.subst_from_current_frame_and_normalize_erasing_regions(constant.literal);
520-
self.eval_const_to_op(val, layout)?
520+
self.const_to_op(val, layout)?
521521
}
522522
};
523523
trace!("{:?}: {:?}", mir_op, *op);
@@ -536,7 +536,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
536536
// in patterns via the `const_eval` module
537537
/// The `val` and `layout` are assumed to already be in our interpreter
538538
/// "universe" (param_env).
539-
crate fn eval_const_to_op(
539+
crate fn const_to_op(
540540
&self,
541541
val: &ty::Const<'tcx>,
542542
layout: Option<TyAndLayout<'tcx>>,
@@ -559,16 +559,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
559559
// potentially requiring the current static to be evaluated again. This is not a
560560
// problem here, because we are building an operand which means an actual read is
561561
// happening.
562-
//
563-
// The machine callback `adjust_global_const` below is guaranteed to
564-
// be called for all constants because `const_eval` calls
565-
// `eval_const_to_op` recursively.
566562
return Ok(self.const_eval(GlobalId { instance, promoted }, val.ty)?);
567563
}
568564
ty::ConstKind::Infer(..)
569565
| ty::ConstKind::Bound(..)
570566
| ty::ConstKind::Placeholder(..) => {
571-
span_bug!(self.cur_span(), "eval_const_to_op: Unexpected ConstKind {:?}", val)
567+
span_bug!(self.cur_span(), "const_to_op: Unexpected ConstKind {:?}", val)
572568
}
573569
ty::ConstKind::Value(val_val) => val_val,
574570
};

src/librustc_mir/transform/const_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
436436
return None;
437437
}
438438

439-
match self.ecx.eval_const_to_op(c.literal, None) {
439+
match self.ecx.const_to_op(c.literal, None) {
440440
Ok(op) => Some(op),
441441
Err(error) => {
442442
let tcx = self.ecx.tcx.at(c.span);

0 commit comments

Comments
 (0)