Skip to content

Commit

Permalink
Make ScalarInt entirely independent of MIR interpretation
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Nov 4, 2020
1 parent 2e53625 commit 97bfff1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compiler/rustc_middle/src/ty/consts/int.rs
@@ -1,4 +1,3 @@
use crate::mir::interpret::InterpResult;
use rustc_apfloat::ieee::{Double, Single};
use rustc_apfloat::Float;
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
Expand Down Expand Up @@ -192,11 +191,11 @@ impl ScalarInt {
self.data == 0
}

pub(crate) fn ptr_sized_op<'tcx>(
pub(crate) fn ptr_sized_op<E>(
self,
dl: &TargetDataLayout,
f_int: impl FnOnce(u64) -> InterpResult<'tcx, u64>,
) -> InterpResult<'tcx, Self> {
f_int: impl FnOnce(u64) -> Result<u64, E>,
) -> Result<Self, E> {
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())
}
Expand Down

0 comments on commit 97bfff1

Please sign in to comment.