]> git.lizzy.rs Git - rust.git/commitdiff
ptr-to-int alignment sanity check
authorRalf Jung <post@ralfj.de>
Fri, 28 Jun 2019 07:12:11 +0000 (09:12 +0200)
committerRalf Jung <post@ralfj.de>
Fri, 28 Jun 2019 07:12:11 +0000 (09:12 +0200)
src/intptrcast.rs

index ad0489fa7de860918635caba838441246e8368da..176e1bc591c2e6b3259853818c1ec881f38ccdd9 100644 (file)
@@ -89,6 +89,7 @@ pub fn ptr_to_int(
             }
         };
 
+        debug_assert_eq!(base_addr % alloc.align.bytes(), 0); // sanity check
         Ok(base_addr + ptr.offset.bytes())
     }