diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-03 17:49:59 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2024-04-03 19:06:22 +0300 |
| commit | b40ea03f8a9a94c294679b9f261b86ded120454f (patch) | |
| tree | 18e32ab93e0d4506cc8c973e3be253ebe079c03f /compiler/rustc_index_macros | |
| parent | ceab6128fa48a616bfd3e3adf4bc80133b8ee223 (diff) | |
| download | rust-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.rs | 3 |
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 |
