about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/indexed_vec.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index 82882f94440..ce2468fb9f1 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -49,6 +49,13 @@ macro_rules! newtype_index {
          RustcEncodable, RustcDecodable)]
         pub struct $name(u32);
 
+        impl $name {
+            // HACK use for constants
+            pub const fn const_new(x: u32) -> Self {
+                $name(x)
+            }
+        }
+
         impl Idx for $name {
             fn new(value: usize) -> Self {
                 assert!(value < (::std::u32::MAX) as usize);