diff options
| author | Ralf Jung <post@ralfj.de> | 2017-07-21 20:02:44 -0700 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2017-07-21 20:02:48 -0700 |
| commit | 40950b2cd18a7a62b14c80d92be60ebf2f6b62a3 (patch) | |
| tree | 47d2b34105197b21a645a790fbdf87973ca72ec4 /src | |
| parent | b174b786b6a0a0ad38101ead656a6fd02e086a05 (diff) | |
| download | rust-40950b2cd18a7a62b14c80d92be60ebf2f6b62a3.tar.gz rust-40950b2cd18a7a62b14c80d92be60ebf2f6b62a3.zip | |
fix nits
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/cast.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 7db8cb79f5d..f33fe3ac889 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -77,8 +77,8 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { TyChar if v as u8 as u128 == v => Ok(PrimVal::Bytes(v)), TyChar => Err(EvalError::InvalidChar(v)), - // No alignment check needed for raw pointers - TyRawPtr(_) => Ok(PrimVal::Bytes(v % (1 << (self.memory.pointer_size()*8)))), + // No alignment check needed for raw pointers. But we have to truncate to target ptr size. + TyRawPtr(_) => Ok(PrimVal::Bytes(v % (1u128 << self.memory.layout.pointer_size.bits()))), _ => Err(EvalError::Unimplemented(format!("int to {:?} cast", ty))), } |
