about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2017-09-28 15:56:28 -0300
committerSantiago Pastorino <spastorino@gmail.com>2017-10-04 23:51:43 -0300
commitb5a5556dd4807ee97cb51ab395d5dbfc858152dd (patch)
tree8f475d81149f5da2acb3dfe496af7b33d05af6a9 /src/librustc_data_structures
parent3502bec0322829d8bbe61b65c62bb796814e4bd3 (diff)
downloadrust-b5a5556dd4807ee97cb51ab395d5dbfc858152dd.tar.gz
rust-b5a5556dd4807ee97cb51ab395d5dbfc858152dd.zip
Generate DepNodeIndexNew using newtype_index macro
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);