add assert to block address unsafe constructos

This commit is contained in:
Szymon Walter 2018-03-20 10:33:17 +01:00
parent 2966b628fa
commit 63f0203601

View file

@ -43,6 +43,7 @@ pub struct Address<S: Size> {
impl<S: Size> Address<S> { impl<S: Size> Address<S> {
pub unsafe fn new_unchecked(block: usize, offset: usize) -> Address<S> { pub unsafe fn new_unchecked(block: usize, offset: usize) -> Address<S> {
assert!(offset < S::SIZE, "offset out of block bounds");
let _phantom = PhantomData; let _phantom = PhantomData;
Address { Address {
block, block,