]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_index/src/vec.rs
Auto merge of #83722 - jyn514:stable-help, r=estebank
[rust.git] / compiler / rustc_index / src / vec.rs
index 3882818952c33dfa580c21cf437af25606e1ea64..1b1a59a254e6fbd0bfb41e745037e49cb667babf 100644 (file)
@@ -124,7 +124,8 @@ impl $type {
 
             #[inline]
             $v const fn from_usize(value: usize) -> Self {
-                assert!(value <= ($max as usize));
+                // FIXME: replace with `assert!(value <= ($max as usize));` once `const_panic` is stable
+                [()][(value > ($max as usize)) as usize];
                 unsafe {
                     Self::from_u32_unchecked(value as u32)
                 }
@@ -132,7 +133,8 @@ impl $type {
 
             #[inline]
             $v const fn from_u32(value: u32) -> Self {
-                assert!(value <= $max);
+                // FIXME: replace with `assert!(value <= $max);` once `const_panic` is stable
+                [()][(value > $max) as usize];
                 unsafe {
                     Self::from_u32_unchecked(value)
                 }