Make ScalarInt
entirely independent of MIR interpretation
This commit is contained in:
parent
2e53625421
commit
97bfff1f56
@ -1,4 +1,3 @@
|
|||||||
use crate::mir::interpret::InterpResult;
|
|
||||||
use rustc_apfloat::ieee::{Double, Single};
|
use rustc_apfloat::ieee::{Double, Single};
|
||||||
use rustc_apfloat::Float;
|
use rustc_apfloat::Float;
|
||||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||||
@ -192,11 +191,11 @@ impl ScalarInt {
|
|||||||
self.data == 0
|
self.data == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn ptr_sized_op<'tcx>(
|
pub(crate) fn ptr_sized_op<E>(
|
||||||
self,
|
self,
|
||||||
dl: &TargetDataLayout,
|
dl: &TargetDataLayout,
|
||||||
f_int: impl FnOnce(u64) -> InterpResult<'tcx, u64>,
|
f_int: impl FnOnce(u64) -> Result<u64, E>,
|
||||||
) -> InterpResult<'tcx, Self> {
|
) -> Result<Self, E> {
|
||||||
assert_eq!(u64::from(self.size), dl.pointer_size.bytes());
|
assert_eq!(u64::from(self.size), dl.pointer_size.bytes());
|
||||||
Ok(Self::try_from_uint(f_int(u64::try_from(self.data).unwrap())?, self.size()).unwrap())
|
Ok(Self::try_from_uint(f_int(u64::try_from(self.data).unwrap())?, self.size()).unwrap())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user