Add fixme comment to revert change once const_panic is stable

This commit is contained in:
Wilco Kusee 2021-04-03 13:07:03 +02:00
parent 3cfa0a0dff
commit 3ea7c90a94
1 changed files with 2 additions and 0 deletions

View File

@ -124,6 +124,7 @@ macro_rules! newtype_index {
#[inline] #[inline]
$v const fn from_usize(value: usize) -> Self { $v const fn from_usize(value: usize) -> Self {
// FIXME: replace with `assert!(value <= ($max as usize));` once `const_panic` is stable
[()][(value > ($max as usize)) as usize]; [()][(value > ($max as usize)) as usize];
unsafe { unsafe {
Self::from_u32_unchecked(value as u32) Self::from_u32_unchecked(value as u32)
@ -132,6 +133,7 @@ macro_rules! newtype_index {
#[inline] #[inline]
$v const fn from_u32(value: u32) -> Self { $v const fn from_u32(value: u32) -> Self {
// FIXME: replace with `assert!(value <= $max);` once `const_panic` is stable
[()][(value > $max) as usize]; [()][(value > $max) as usize];
unsafe { unsafe {
Self::from_u32_unchecked(value) Self::from_u32_unchecked(value)