Remove unnecessary transmute_primval function.
This commit is contained in:
parent
0929201d60
commit
fd02285788
@ -97,8 +97,8 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
fn cast_ptr(&self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, PrimVal> {
|
||||
use rustc::ty::TypeVariants::*;
|
||||
match ty.sty {
|
||||
TyRef(..) | TyRawPtr(_) | TyFnPtr(_) => Ok(PrimVal::from_ptr(ptr)),
|
||||
TyInt(_) | TyUint(_) => self.transmute_primval(PrimVal::from_ptr(ptr), ty),
|
||||
TyRef(..) | TyRawPtr(_) | TyFnPtr(_) | TyInt(_) | TyUint(_) =>
|
||||
Ok(PrimVal::from_ptr(ptr)),
|
||||
_ => Err(EvalError::Unimplemented(format!("ptr to {:?} cast", ty))),
|
||||
}
|
||||
}
|
||||
|
@ -1165,20 +1165,14 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
Value::ByRef(_) => bug!("follow_by_ref_value can't result in `ByRef`"),
|
||||
|
||||
Value::ByVal(primval) => {
|
||||
let new_primval = self.transmute_primval(primval, ty)?;
|
||||
self.ensure_valid_value(new_primval, ty)?;
|
||||
Ok(new_primval)
|
||||
self.ensure_valid_value(primval, ty)?;
|
||||
Ok(primval)
|
||||
}
|
||||
|
||||
Value::ByValPair(..) => bug!("value_to_primval can't work with fat pointers"),
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(solson): Delete this.
|
||||
fn transmute_primval(&self, val: PrimVal, _ty: Ty<'tcx>) -> EvalResult<'tcx, PrimVal> {
|
||||
Ok(val)
|
||||
}
|
||||
|
||||
fn write_primval(
|
||||
&mut self,
|
||||
dest: Lvalue<'tcx>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user