add assert to block address unsafe constructos
This commit is contained in:
parent
2966b628fa
commit
63f0203601
|
@ -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,
|
||||||
|
|
Reference in a new issue