Skip to content

Commit

Permalink
Follow naming scheme for "frame" methods
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 23, 2019
1 parent 2c57d1d commit d4ee556
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
}
}

pub fn monomorphize_in_frame<T: TypeFoldable<'tcx> + Subst<'tcx>>(
pub(super) fn monomorphize<T: TypeFoldable<'tcx> + Subst<'tcx>>(
&self,
t: T,
) -> EvalResult<'tcx, T> {
match self.stack.last() {
Some(frame) => Ok(self.monomorphize(t, frame.instance.substs)),
Some(frame) => Ok(self.monomorphize_with_substs(t, frame.instance.substs)),
None => if t.needs_subst() {
err!(TooGeneric).into()
} else {
Expand All @@ -296,7 +296,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
}
}

pub fn monomorphize<T: TypeFoldable<'tcx> + Subst<'tcx>>(
fn monomorphize_with_substs<T: TypeFoldable<'tcx> + Subst<'tcx>>(
&self,
t: T,
substs: &'tcx Substs<'tcx>
Expand All @@ -315,7 +315,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
let cell = &frame.local_layouts[local];
if cell.get().is_none() {
let local_ty = frame.mir.local_decls[local].ty;
let local_ty = self.monomorphize(local_ty, frame.instance.substs);
let local_ty = self.monomorphize_with_substs(local_ty, frame.instance.substs);
let layout = self.layout_of(local_ty)?;
cell.set(Some(layout));
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>

Constant(ref constant) => {
let layout = from_known_layout(layout, || {
let ty = self.monomorphize_in_frame(mir_op.ty(self.mir(), *self.tcx))?;
let ty = self.monomorphize(mir_op.ty(self.mir(), *self.tcx))?;
self.layout_of(ty)
})?;
let op = self.const_value_to_op(*constant.literal)?;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
}

NullaryOp(mir::NullOp::SizeOf, ty) => {
let ty = self.monomorphize_in_frame(ty)?;
let ty = self.monomorphize(ty)?;
let layout = self.layout_of(ty)?;
assert!(!layout.is_unsized(),
"SizeOf nullary MIR operator called for unsized type");
Expand All @@ -260,7 +260,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
}

Cast(kind, ref operand, cast_ty) => {
debug_assert_eq!(self.monomorphize_in_frame(cast_ty)?, dest.layout.ty);
debug_assert_eq!(self.monomorphize(cast_ty)?, dest.layout.ty);
let src = self.eval_operand(operand, None)?;
self.cast(src, kind, dest)?;
}
Expand Down

0 comments on commit d4ee556

Please sign in to comment.