Skip to content

Commit e5e72f6

Browse files
committed
switch back to using a plain u32, not NonZeroU32
This reverts (part of) commit cb9a336ae2cf6a75fdcc130853286349cb424c96.
1 parent ec0ad09 commit e5e72f6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_data_structures/indexed_vec.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ macro_rules! newtype_index {
9898
@debug_format [$debug_format:tt]) => (
9999
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
100100
$v struct $type {
101-
private: ::std::num::NonZeroU32
101+
private: u32
102102
}
103103

104104
impl $type {
@@ -142,7 +142,7 @@ macro_rules! newtype_index {
142142

143143
#[inline]
144144
$v const unsafe fn from_u32_unchecked(value: u32) -> Self {
145-
$type { private: ::std::num::NonZeroU32::new_unchecked(value + 1) }
145+
$type { private: value }
146146
}
147147

148148
/// Extract value of this index as an integer.
@@ -153,13 +153,13 @@ macro_rules! newtype_index {
153153

154154
/// Extract value of this index as a usize.
155155
#[inline]
156-
$v fn as_u32(self) -> u32 {
157-
self.private.get() - 1
156+
$v const fn as_u32(self) -> u32 {
157+
self.private
158158
}
159159

160160
/// Extract value of this index as a u32.
161161
#[inline]
162-
$v fn as_usize(self) -> usize {
162+
$v const fn as_usize(self) -> usize {
163163
self.as_u32() as usize
164164
}
165165
}

0 commit comments

Comments
 (0)