Skip to content

Commit a0c2ca1

Browse files
committed
eval_mir_constant doesn't need a builder param
1 parent 2b688a9 commit a0c2ca1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
657657
span_bug!(span, "shuffle indices must be constant");
658658
}
659659
mir::Operand::Constant(ref constant) => {
660-
let c = self.eval_mir_constant(&bx, constant);
660+
let c = self.eval_mir_constant(constant);
661661
let (llval, ty) = self.simd_shuffle_indices(
662662
&bx,
663663
constant.span,

src/librustc_codegen_ssa/mir/constant.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_mir::const_eval::const_field;
33
use rustc::mir;
44
use rustc_data_structures::indexed_vec::Idx;
55
use rustc::ty::{self, Ty};
6-
use rustc::ty::layout;
6+
use rustc::ty::layout::{self, HasTyCtxt};
77
use syntax::source_map::Span;
88
use crate::traits::*;
99

@@ -12,20 +12,19 @@ use super::FunctionCx;
1212
impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1313
pub fn eval_mir_constant(
1414
&mut self,
15-
bx: &Bx,
1615
constant: &mir::Constant<'tcx>,
1716
) -> Result<ty::Const<'tcx>, ErrorHandled> {
1817
match constant.literal.val {
1918
mir::interpret::ConstValue::Unevaluated(def_id, ref substs) => {
2019
let substs = self.monomorphize(substs);
2120
let instance = ty::Instance::resolve(
22-
bx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs,
21+
self.cx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs,
2322
).unwrap();
2423
let cid = mir::interpret::GlobalId {
2524
instance,
2625
promoted: None,
2726
};
28-
bx.tcx().const_eval(ty::ParamEnv::reveal_all().and(cid))
27+
self.cx.tcx().const_eval(ty::ParamEnv::reveal_all().and(cid))
2928
},
3029
_ => Ok(*self.monomorphize(&constant.literal)),
3130
}

src/librustc_codegen_ssa/mir/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
460460

461461
mir::Operand::Constant(ref constant) => {
462462
let ty = self.monomorphize(&constant.ty);
463-
self.eval_mir_constant(bx, constant)
463+
self.eval_mir_constant(constant)
464464
.and_then(|c| OperandRef::from_const(bx, c))
465465
.unwrap_or_else(|err| {
466466
match err {

0 commit comments

Comments
 (0)