Skip to content

Commit 5e175e6

Browse files
Use normal u32 for newtype_index
1 parent d8c8173 commit 5e175e6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ newtype_index! {
14981498
impl_stable_hash_for!(struct UniverseIndex { private });
14991499

15001500
impl UniverseIndex {
1501-
pub const ROOT: UniverseIndex = UniverseIndex::from_u32_const(0);
1501+
pub const ROOT: UniverseIndex = UniverseIndex::from_u32(0);
15021502

15031503
/// Returns the "next" universe index in order -- this new index
15041504
/// is considered to extend all previous universes. This

src/librustc_data_structures/indexed_vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ macro_rules! newtype_index {
101101
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
102102
#[rustc_layout_scalar_valid_range_end($max)]
103103
$v struct $type {
104-
private: ::std::num::NonZeroU32
104+
private: u32
105105
}
106106

107107
impl $type {
@@ -134,7 +134,7 @@ macro_rules! newtype_index {
134134

135135
#[inline]
136136
$v const unsafe fn from_u32_unchecked(value: u32) -> Self {
137-
$type { private: ::std::num::NonZeroU32::new_unchecked(value + 1) }
137+
$type { private: value }
138138
}
139139

140140
/// Extract value of this index as an integer.
@@ -146,7 +146,7 @@ macro_rules! newtype_index {
146146
/// Extract value of this index as a usize.
147147
#[inline]
148148
$v const fn as_u32(self) -> u32 {
149-
self.private.get() - 1
149+
self.private
150150
}
151151

152152
/// Extract value of this index as a u32.

0 commit comments

Comments
 (0)