From 3ea7c90a947132977ddb95024bbf05faea851fd9 Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Sat, 3 Apr 2021 13:07:03 +0200 Subject: [PATCH] Add fixme comment to revert change once const_panic is stable --- compiler/rustc_index/src/vec.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 6b29079109e..1b1a59a254e 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -124,6 +124,7 @@ macro_rules! newtype_index { #[inline] $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]; unsafe { Self::from_u32_unchecked(value as u32) @@ -132,6 +133,7 @@ macro_rules! newtype_index { #[inline] $v const fn from_u32(value: u32) -> Self { + // FIXME: replace with `assert!(value <= $max);` once `const_panic` is stable [()][(value > $max) as usize]; unsafe { Self::from_u32_unchecked(value)