about summary refs log tree commit diff
path: root/compiler/rustc_index_macros
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-04-03 17:49:59 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-04-03 19:06:22 +0300
commitb40ea03f8a9a94c294679b9f261b86ded120454f (patch)
tree18e32ab93e0d4506cc8c973e3be253ebe079c03f /compiler/rustc_index_macros
parentceab6128fa48a616bfd3e3adf4bc80133b8ee223 (diff)
downloadrust-b40ea03f8a9a94c294679b9f261b86ded120454f.tar.gz
rust-b40ea03f8a9a94c294679b9f261b86ded120454f.zip
rustc_index: Add a `ZERO` constant to index types
It is commonly used.
Diffstat (limited to 'compiler/rustc_index_macros')
-rw-r--r--compiler/rustc_index_macros/src/newtype.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_index_macros/src/newtype.rs b/compiler/rustc_index_macros/src/newtype.rs
index e5c2ba42483..fe9a048734f 100644
--- a/compiler/rustc_index_macros/src/newtype.rs
+++ b/compiler/rustc_index_macros/src/newtype.rs
@@ -174,6 +174,9 @@ impl Parse for Newtype {
                 /// Maximum value the index can take.
                 #vis const MAX: Self = Self::from_u32(#max);
 
+                /// Zero value of the index.
+                #vis const ZERO: Self = Self::from_u32(0);
+
                 /// Creates a new index from a given `usize`.
                 ///
                 /// # Panics