Skip to content

Commit bb9f717

Browse files
committed
const_to_op is now lazy_const_to_op
1 parent f36c655 commit bb9f717

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_mir/const_eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn op_to_const<'tcx>(
137137
Ok(ty::Const::from_const_value(ecx.tcx.tcx, val, op.layout.ty))
138138
}
139139

140-
pub fn const_to_op<'tcx>(
140+
pub fn lazy_const_to_op<'tcx>(
141141
ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
142142
cnst: ty::LazyConst<'tcx>,
143143
ty: ty::Ty<'tcx>,
@@ -516,7 +516,7 @@ pub fn const_field<'a, 'tcx>(
516516
let ecx = mk_eval_cx(tcx, instance, param_env).unwrap();
517517
let result = (|| {
518518
// get the operand again
519-
let op = const_to_op(&ecx, ty::LazyConst::Evaluated(value), value.ty)?;
519+
let op = lazy_const_to_op(&ecx, ty::LazyConst::Evaluated(value), value.ty)?;
520520
// downcast
521521
let down = match variant {
522522
None => op,
@@ -543,7 +543,7 @@ pub fn const_variant_index<'a, 'tcx>(
543543
) -> EvalResult<'tcx, VariantIdx> {
544544
trace!("const_variant_index: {:?}, {:?}", instance, val);
545545
let ecx = mk_eval_cx(tcx, instance, param_env).unwrap();
546-
let op = const_to_op(&ecx, ty::LazyConst::Evaluated(val), val.ty)?;
546+
let op = lazy_const_to_op(&ecx, ty::LazyConst::Evaluated(val), val.ty)?;
547547
Ok(ecx.read_discriminant(op)?.1)
548548
}
549549

src/librustc_mir/transform/const_prop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc::ty::layout::{
2020

2121
use interpret::{self, EvalContext, ScalarMaybeUndef, Immediate, OpTy, MemoryKind};
2222
use const_eval::{
23-
CompileTimeInterpreter, const_to_op, error_to_const_error, eval_promoted, mk_borrowck_eval_cx
23+
CompileTimeInterpreter, lazy_const_to_op, error_to_const_error, eval_promoted, mk_borrowck_eval_cx
2424
};
2525
use transform::{MirPass, MirSource};
2626

@@ -255,7 +255,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
255255
source_info: SourceInfo,
256256
) -> Option<Const<'tcx>> {
257257
self.ecx.tcx.span = source_info.span;
258-
match const_to_op(&self.ecx, *c.literal, c.ty) {
258+
match lazy_const_to_op(&self.ecx, *c.literal, c.ty) {
259259
Ok(op) => {
260260
Some((op, c.span))
261261
},

0 commit comments

Comments
 (0)