diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2018-09-06 13:21:35 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2018-09-07 11:37:47 -0400 |
| commit | e5e72f6666876b3a124c42d79631d4e353673922 (patch) | |
| tree | 2230a1b7f84e95937861c3442b7f86487e40dee0 | |
| parent | ec0ad090592e97e81856ad7c179dee2ab6d07049 (diff) | |
switch back to using a plain `u32`, not `NonZeroU32`
This reverts (part of) commit cb9a336ae2cf6a75fdcc130853286349cb424c96.
| -rw-r--r-- | src/librustc_data_structures/indexed_vec.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 9240eaec3b4..31dba2c2cdf 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -98,7 +98,7 @@ macro_rules! newtype_index { @debug_format [$debug_format:tt]) => ( #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)] $v struct $type { - private: ::std::num::NonZeroU32 + private: u32 } impl $type { @@ -142,7 +142,7 @@ macro_rules! newtype_index { #[inline] $v const unsafe fn from_u32_unchecked(value: u32) -> Self { - $type { private: ::std::num::NonZeroU32::new_unchecked(value + 1) } + $type { private: value } } /// Extract value of this index as an integer. @@ -153,13 +153,13 @@ macro_rules! newtype_index { /// Extract value of this index as a usize. #[inline] - $v fn as_u32(self) -> u32 { - self.private.get() - 1 + $v const fn as_u32(self) -> u32 { + self.private } /// Extract value of this index as a u32. #[inline] - $v fn as_usize(self) -> usize { + $v const fn as_usize(self) -> usize { self.as_u32() as usize } } |
