Skip to content

Commit

Permalink
switch back to using a plain u32, not NonZeroU32
Browse files Browse the repository at this point in the history
This reverts (part of) commit cb9a336ae2cf6a75fdcc130853286349cb424c96.
  • Loading branch information
nikomatsakis committed Sep 7, 2018
1 parent ec0ad09 commit e5e72f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustc_data_structures/indexed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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
}
}
Expand Down

0 comments on commit e5e72f6

Please sign in to comment.