add assert to block address unsafe constructos

pull/3/head
Szymon Walter 2018-03-20 10:33:17 +01:00
parent 2966b628fa
commit 63f0203601
1 changed files with 1 additions and 0 deletions

View File

@ -43,6 +43,7 @@ pub struct Address<S: Size> {
impl<S: Size> 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;
Address {
block,