We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3cfa0a0 commit 3ea7c90Copy full SHA for 3ea7c90
compiler/rustc_index/src/vec.rs
@@ -124,6 +124,7 @@ macro_rules! newtype_index {
124
125
#[inline]
126
$v const fn from_usize(value: usize) -> Self {
127
+ // FIXME: replace with `assert!(value <= ($max as usize));` once `const_panic` is stable
128
[()][(value > ($max as usize)) as usize];
129
unsafe {
130
Self::from_u32_unchecked(value as u32)
@@ -132,6 +133,7 @@ macro_rules! newtype_index {
132
133
134
135
$v const fn from_u32(value: u32) -> Self {
136
+ // FIXME: replace with `assert!(value <= $max);` once `const_panic` is stable
137
[()][(value > $max) as usize];
138
139
Self::from_u32_unchecked(value)
0 commit comments