1
Fork 0

fix formatting nits

This commit is contained in:
Ralf Jung 2018-08-17 12:31:50 +02:00
parent 5099933614
commit ad8deba23a
3 changed files with 7 additions and 7 deletions

View file

@ -195,7 +195,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
self.memory.check_align(ptr, ptr_align)?;
if mplace.layout.size.bytes() == 0 {
return Ok(Some(Value::Scalar(ScalarMaybeUndef::Scalar(Scalar::Bits { bits: 0, size: 0 }))));
return Ok(Some(Value::Scalar(Scalar::zst().into())));
}
let ptr = ptr.to_ptr()?;
@ -228,7 +228,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
/// in a `Value`, not on which data is stored there currently.
pub(super) fn try_read_value(
&self,
src : OpTy<'tcx>,
src: OpTy<'tcx>,
) -> EvalResult<'tcx, Result<Value, MemPlace>> {
Ok(match src.try_as_mplace() {
Ok(mplace) => {
@ -253,7 +253,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
}
/// Read a scalar from a place
pub fn read_scalar(&self, op : OpTy<'tcx>) -> EvalResult<'tcx, ScalarMaybeUndef> {
pub fn read_scalar(&self, op: OpTy<'tcx>) -> EvalResult<'tcx, ScalarMaybeUndef> {
match *self.read_value(op)? {
Value::ScalarPair(..) => bug!("got ScalarPair for type: {:?}", op.layout.ty),
Value::Scalar(val) => Ok(val),

View file

@ -403,7 +403,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
/// Just a convenience function, but used quite a bit.
pub fn place_field(
&mut self,
base : PlaceTy<'tcx>,
base: PlaceTy<'tcx>,
field: u64,
) -> EvalResult<'tcx, PlaceTy<'tcx>> {
// FIXME: We could try to be smarter and avoid allocation for fields that span the
@ -414,7 +414,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
pub fn place_downcast(
&mut self,
base : PlaceTy<'tcx>,
base: PlaceTy<'tcx>,
variant: usize,
) -> EvalResult<'tcx, PlaceTy<'tcx>> {
// Downcast just changes the layout
@ -515,7 +515,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
pub fn write_value(
&mut self,
src_val: Value,
dest : PlaceTy<'tcx>,
dest: PlaceTy<'tcx>,
) -> EvalResult<'tcx> {
trace!("write_value: {:?} <- {:?}", *dest, src_val);
// See if we can avoid an allocation. This is the counterpart to `try_read_value`,

View file

@ -2,7 +2,7 @@ use rustc::mir::BasicBlock;
use rustc::ty::{self, layout::LayoutOf};
use syntax::source_map::Span;
use rustc::mir::interpret::{EvalResult};
use rustc::mir::interpret::EvalResult;
use interpret::{Machine, EvalContext, PlaceTy, PlaceExtra, OpTy, Operand};
impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {