Skip to content

Commit

Permalink
Add a debug_assert in NonZeroUsize::new
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jun 29, 2017
1 parent a880396 commit ee0c6e7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub struct NonZeroUsize(&'static u8);
impl NonZeroUsize {
#[inline]
pub unsafe fn new(value: usize) -> Self {
debug_assert!(value != 0);
NonZeroUsize(&*(value as *const u8))
}

Expand Down

0 comments on commit ee0c6e7

Please sign in to comment.