about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/dep_graph/graph.rs6
-rw-r--r--src/librustc/hir/def_id.rs8
-rw-r--r--src/librustc/middle/region.rs2
-rw-r--r--src/librustc/mir/mod.rs4
-rw-r--r--src/librustc/ty/sty.rs8
-rw-r--r--src/librustc_data_structures/indexed_vec.rs16
6 files changed, 23 insertions, 21 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs
index ff8bf3ca9f4..12498782019 100644
--- a/src/librustc/dep_graph/graph.rs
+++ b/src/librustc/dep_graph/graph.rs
@@ -44,7 +44,7 @@ newtype_index! {
 }
 
 impl DepNodeIndex {
-    const INVALID: DepNodeIndex = DepNodeIndex(::std::u32::MAX);
+    const INVALID: DepNodeIndex = DepNodeIndex { private: ::std::u32::MAX };
 }
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@@ -1127,14 +1127,14 @@ impl DepNodeColorMap {
         match self.values[index] {
             COMPRESSED_NONE => None,
             COMPRESSED_RED => Some(DepNodeColor::Red),
-            value => Some(DepNodeColor::Green(DepNodeIndex(value - COMPRESSED_FIRST_GREEN)))
+            value => Some(DepNodeColor::Green(DepNodeIndex { private: value - COMPRESSED_FIRST_GREEN })),
         }
     }
 
     fn insert(&mut self, index: SerializedDepNodeIndex, color: DepNodeColor) {
         self.values[index] = match color {
             DepNodeColor::Red => COMPRESSED_RED,
-            DepNodeColor::Green(index) => index.0 + COMPRESSED_FIRST_GREEN,
+            DepNodeColor::Green(index) => index.private + COMPRESSED_FIRST_GREEN,
         }
     }
 }
diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs
index caf7985226b..2f58c1e9371 100644
--- a/src/librustc/hir/def_id.rs
+++ b/src/librustc/hir/def_id.rs
@@ -41,15 +41,15 @@ newtype_index! {
 impl CrateNum {
     pub fn new(x: usize) -> CrateNum {
         assert!(x < (u32::MAX as usize));
-        CrateNum(x as u32)
+        CrateNum { private: x as u32 }
     }
 
     pub fn from_u32(x: u32) -> CrateNum {
-        CrateNum(x)
+        CrateNum { private: x }
     }
 
     pub fn as_usize(&self) -> usize {
-        self.0 as usize
+        self.private as usize
     }
 
     pub fn as_u32(&self) -> u32 {
@@ -61,7 +61,7 @@ impl CrateNum {
 
 impl fmt::Display for CrateNum {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Display::fmt(&self.0, f)
+        fmt::Display::fmt(&self.private, f)
     }
 }
 
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 0f565a3a7ec..f6a8f8dc172 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -165,7 +165,7 @@ newtype_index! {
     }
 }
 
-impl_stable_hash_for!(tuple_struct ::middle::region::FirstStatementIndex { idx });
+impl_stable_hash_for!(struct ::middle::region::FirstStatementIndex { private });
 
 impl From<ScopeData> for Scope {
     #[inline]
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 3ab8de6de44..7d7fac7d28b 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -132,7 +132,7 @@ pub struct Mir<'tcx> {
 }
 
 /// where execution begins
-pub const START_BLOCK: BasicBlock = BasicBlock(0);
+pub const START_BLOCK: BasicBlock = BasicBlock { private: 0 };
 
 impl<'tcx> Mir<'tcx> {
     pub fn new(
@@ -239,7 +239,7 @@ impl<'tcx> Mir<'tcx> {
 
     #[inline]
     pub fn local_kind(&self, local: Local) -> LocalKind {
-        let index = local.0 as usize;
+        let index = local.private as usize;
         if index == 0 {
             debug_assert!(
                 self.local_decls[local].mutability == Mutability::Mut,
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index e444730b8d0..bc871df4826 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -1274,7 +1274,7 @@ impl DebruijnIndex {
     /// you would need to shift the index for `'a` into 1 new binder.
     #[must_use]
     pub const fn shifted_in(self, amount: u32) -> DebruijnIndex {
-        DebruijnIndex(self.0 + amount)
+        DebruijnIndex { private: self.private + amount }
     }
 
     /// Update this index in place by shifting it "in" through
@@ -1287,7 +1287,7 @@ impl DebruijnIndex {
     /// `amount` number of new binders.
     #[must_use]
     pub const fn shifted_out(self, amount: u32) -> DebruijnIndex {
-        DebruijnIndex(self.0 - amount)
+        DebruijnIndex { private: self.private - amount }
     }
 
     /// Update in place by shifting out from `amount` binders.
@@ -1316,11 +1316,11 @@ impl DebruijnIndex {
     /// bound by one of the binders we are shifting out of, that is an
     /// error (and should fail an assertion failure).
     pub fn shifted_out_to_binder(self, to_binder: DebruijnIndex) -> Self {
-        self.shifted_out((to_binder.0 - INNERMOST.0) as u32)
+        self.shifted_out((to_binder.private - INNERMOST.private) as u32)
     }
 }
 
-impl_stable_hash_for!(tuple_struct DebruijnIndex { index });
+impl_stable_hash_for!(struct DebruijnIndex { private });
 
 /// Region utilities
 impl RegionKind {
diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs
index 107e6b0530e..f7ef8c7af1a 100644
--- a/src/librustc_data_structures/indexed_vec.rs
+++ b/src/librustc_data_structures/indexed_vec.rs
@@ -97,7 +97,9 @@ macro_rules! newtype_index {
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]) => (
         #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
-        $v struct $type(u32);
+        $v struct $type {
+            private: u32
+        }
 
         impl $type {
             /// Extract value of this index as an integer.
@@ -111,12 +113,12 @@ macro_rules! newtype_index {
             #[inline]
             fn new(value: usize) -> Self {
                 assert!(value < ($max) as usize);
-                $type(value as u32)
+                $type { private: value as u32 }
             }
 
             #[inline]
             fn index(self) -> usize {
-                self.0 as usize
+                self.private as usize
             }
         }
 
@@ -151,13 +153,13 @@ macro_rules! newtype_index {
 
         impl From<$type> for u32 {
             fn from(v: $type) -> u32 {
-                v.0
+                v.private
             }
         }
 
         impl From<$type> for usize {
             fn from(v: $type) -> usize {
-                v.0 as usize
+                v.private as usize
             }
         }
 
@@ -193,7 +195,7 @@ macro_rules! newtype_index {
      @debug_format [$debug_format:tt]) => (
         impl ::std::fmt::Debug for $type {
             fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
-                write!(fmt, $debug_format, self.0)
+                write!(fmt, $debug_format, self.private)
             }
         }
     );
@@ -376,7 +378,7 @@ macro_rules! newtype_index {
                    const $name:ident = $constant:expr,
                    $($tokens:tt)*) => (
         $(#[doc = $doc])*
-        pub const $name: $type = $type($constant);
+        pub const $name: $type = $type { private: $constant  };
         newtype_index!(
             @derives      [$($derives,)*]
             @type         [$type]