]> git.lizzy.rs Git - rust.git/commitdiff
make field always private, add `From` impls
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 25 Jul 2018 13:14:04 +0000 (16:14 +0300)
committerNiko Matsakis <niko@alum.mit.edu>
Fri, 7 Sep 2018 15:37:46 +0000 (11:37 -0400)
30 files changed:
src/librustc/hir/def_id.rs
src/librustc/ich/impls_mir.rs
src/librustc/ich/impls_ty.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/region_constraints/mod.rs
src/librustc/infer/unify_key.rs
src/librustc/middle/region.rs
src/librustc/ty/sty.rs
src/librustc/util/ppaux.rs
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/operand.rs
src/librustc_codegen_llvm/mir/place.rs
src/librustc_data_structures/indexed_vec.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/move_errors.rs
src/librustc_mir/borrow_check/nll/facts.rs
src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
src/librustc_mir/build/scope.rs
src/librustc_mir/const_eval.rs
src/librustc_mir/dataflow/at_location.rs
src/librustc_mir/dataflow/graphviz.rs
src/librustc_mir/interpret/operand.rs
src/librustc_mir/interpret/place.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/rustc_peek.rs
src/librustc_mir/util/graphviz.rs

index 0feeb01adbad16fba48588bc7e57a30b633ec042..caf7985226bbfcbab4f723d9fb6d415214f848fe 100644 (file)
@@ -53,7 +53,7 @@ pub fn as_usize(&self) -> usize {
     }
 
     pub fn as_u32(&self) -> u32 {
-        self.0
+        u32::from(*self)
     }
 
     pub fn as_def_id(&self) -> DefId { DefId { krate: *self, index: CRATE_DEF_INDEX } }
index f11e4487964624d74ce17abd7aa57a3d0b0846e9..8b7438cbe63250d4c8e3dfab318a51fe327d716c 100644 (file)
@@ -102,7 +102,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Local {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -112,7 +111,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::BasicBlock {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -122,7 +120,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Field {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -133,7 +130,6 @@ impl<'a> HashStable<StableHashingContext<'a>>
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -143,7 +139,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::Promoted {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
index 68320dfddefbc04934d7a24581d4eb2e4b419f80..e90c4f62f59d5c0ba3c09b5cd42cd9ec7f38ab92 100644 (file)
@@ -143,7 +143,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'a>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -153,7 +152,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::CanonicalVar {
     fn hash_stable<W: StableHasherResult>(&self,
                                           hcx: &mut StableHashingContext<'gcx>,
                                           hasher: &mut StableHasher<W>) {
-        use rustc_data_structures::indexed_vec::Idx;
         self.index().hash_stable(hcx, hasher);
     }
 }
@@ -774,7 +772,6 @@ fn hash_stable<W: StableHasherResult>(&self,
     FnPtrAddrCast
 });
 
-impl_stable_hash_for!(tuple_struct ::middle::region::FirstStatementIndex { idx });
 impl_stable_hash_for!(struct ::middle::region::Scope { id, code });
 
 impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {
index ac6a7f0c2baa8ff7d2ae1e968b35295670004f1e..eabcf1ce4136361878b3879dc62df4271eee517d 100644 (file)
@@ -73,8 +73,6 @@
 use syntax_pos::{Pos, Span};
 use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
 
-use rustc_data_structures::indexed_vec::Idx;
-
 mod note;
 
 mod need_type_info;
index 296808cea2bd733fb58b3f171937cc0c9f98652e..d8f3b9a05bd40f57c3009d3b290a57b06e031672 100644 (file)
@@ -16,7 +16,7 @@
 use super::{MiscVariable, RegionVariableOrigin, SubregionOrigin};
 use super::unify_key;
 
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::unify as ut;
 use ty::{self, Ty, TyCtxt};
index a1145572b79d95d9a80460cb22ac0821d1c40669..cdc92877a5ae82e0596f6b256af74e78136852fb 100644 (file)
@@ -49,8 +49,8 @@ fn unify_values(value1: &Self, value2: &Self) -> Result<Self, NoError> {
 
 impl UnifyKey for ty::RegionVid {
     type Value = RegionVidKey;
-    fn index(&self) -> u32 { self.0 }
-    fn from_index(i: u32) -> ty::RegionVid { ty::RegionVid(i) }
+    fn index(&self) -> u32 { u32::from(*self) }
+    fn from_index(i: u32) -> ty::RegionVid { ty::RegionVid::from(i) }
     fn tag() -> &'static str { "RegionVid" }
 }
 
index fceab160192b1e60eec35387fab70cda761c5707..0f565a3a7ec16043b7956a0fa7057e91610778c2 100644 (file)
@@ -161,11 +161,12 @@ pub struct BlockRemainder {
 
 newtype_index! {
     pub struct FirstStatementIndex {
-        pub idx
         MAX = SCOPE_DATA_REMAINDER_MAX
     }
 }
 
+impl_stable_hash_for!(tuple_struct ::middle::region::FirstStatementIndex { idx });
+
 impl From<ScopeData> for Scope {
     #[inline]
     fn from(scope_data: ScopeData) -> Self {
index f15f7093d9428aa21ebbce08902defde8a4620ee..e444730b8d032ea3595b1b8ec068d94773718be7 100644 (file)
@@ -1179,7 +1179,6 @@ pub struct FloatVid {
 
 newtype_index! {
     pub struct RegionVid {
-        pub idx
         DEBUG_FORMAT = custom,
     }
 }
@@ -1190,18 +1189,6 @@ fn index(self) -> usize {
     }
 }
 
-impl From<usize> for RegionVid {
-    fn from(i: usize) -> RegionVid {
-        RegionVid::new(i)
-    }
-}
-
-impl From<RegionVid> for usize {
-    fn from(vid: RegionVid) -> usize {
-        Idx::index(vid)
-    }
-}
-
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)]
 pub enum InferTy {
     TyVar(TyVid),
index 0f15c75c2fb36115bdc221e7033ed82b4ab43843..e8236e21e246342e7f1db270b6b15a63d776a90a 100644 (file)
@@ -26,7 +26,6 @@
 use std::fmt;
 use std::usize;
 
-use rustc_data_structures::indexed_vec::Idx;
 use rustc_target::spec::abi::Abi;
 use syntax::ast::CRATE_NODE_ID;
 use syntax::symbol::{Symbol, InternedString};
index 9e65144bd60a1fd87fd6ff425fd76a676fe34a42..258fe643c3067cad32126a200fa6a4c2cce90378 100644 (file)
@@ -32,7 +32,7 @@
 use std::iter;
 
 use rustc_data_structures::bitvec::BitArray;
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::indexed_vec::IndexVec;
 
 pub use self::constant::codegen_static_initializer;
 
index 419e7298588c595f95aad5a2d2e70fa2da1b65b8..bfa0e0a451e6f86ad0d40b981ce7fa54743fc125 100644 (file)
@@ -13,7 +13,6 @@
 use rustc::mir::interpret::{ConstValue, ScalarMaybeUndef};
 use rustc::ty;
 use rustc::ty::layout::{self, Align, LayoutOf, TyLayout};
-use rustc_data_structures::indexed_vec::Idx;
 use rustc_data_structures::sync::Lrc;
 
 use base;
index 833dca8c75fd52ed4dc753f83e346e163a36b801..4baab1763c31059288385dfe5b9a193482c49945 100644 (file)
@@ -13,7 +13,6 @@
 use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, Size};
 use rustc::mir;
 use rustc::mir::tcx::PlaceTy;
-use rustc_data_structures::indexed_vec::Idx;
 use base;
 use builder::Builder;
 use common::{CodegenCx, C_undef, C_usize, C_u8, C_u32, C_uint, C_null, C_uint_big};
index 09015957f99a20d2a8f1246570325ec45d507b2a..107e6b0530effb16265492d6da83df323f8b4e45 100644 (file)
@@ -49,12 +49,20 @@ fn index(self) -> usize { self as usize }
 }
 
 /// Creates a struct type `S` that can be used as an index with
-/// `IndexVec` and so on.  This struct can be constructed via `S::new`
-/// (given a `usize`) and converted to a usize with the `index()`
-/// method (from the `Idx` trait). Internally, the index uses a u32,
-/// so the index must not exceed `u32::MAX`. You can also customize
-/// things like the `Debug` impl, what traits are derived, and so
-/// forth.
+/// `IndexVec` and so on.
+///
+/// There are two ways of interacting with these indices:
+///
+/// - The `From` impls are the preferred way. So you can do
+///   `S::from(v)` with a `usize` or `u32`. And you can convert back
+///   to an integer with `u32::from(s)`.
+///
+/// - Alternatively, you can use the methods `S::new(v)` and `s.index()`
+///   to create/return a value.
+///
+/// Internally, the index uses a u32, so the index must not exceed
+/// `u32::MAX`. You can also customize things like the `Debug` impl,
+/// what traits are derived, and so forth via the macro.
 #[macro_export]
 macro_rules! newtype_index {
     // ---- public rules ----
@@ -84,13 +92,20 @@ macro_rules! newtype_index {
 
     // Base case, user-defined constants (if any) have already been defined
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]) => (
         #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)]
-        $v struct $type($($pub)* u32);
+        $v struct $type(u32);
+
+        impl $type {
+            /// Extract value of this index as an integer.
+            #[inline]
+            $v fn index(self) -> usize {
+                <Self as Idx>::index(self)
+            }
+        }
 
         impl Idx for $type {
             #[inline]
@@ -134,6 +149,30 @@ fn add_usize(&self, u: usize) -> Option<Self> {
             }
         }
 
+        impl From<$type> for u32 {
+            fn from(v: $type) -> u32 {
+                v.0
+            }
+        }
+
+        impl From<$type> for usize {
+            fn from(v: $type) -> usize {
+                v.0 as usize
+            }
+        }
+
+        impl From<usize> for $type {
+            fn from(v: usize) -> Self {
+                Self::new(v)
+            }
+        }
+
+        impl From<u32> for $type {
+            fn from(v: u32) -> Self {
+                Self::new(v as usize)
+            }
+        }
+
         newtype_index!(
             @handle_debug
             @derives      [$($derives,)*]
@@ -177,47 +216,14 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
             @debug_format [$debug_format]);
     );
 
-    // Handle the case where someone wants to make the internal field public
-    (@type         [$type:ident]
-     @max          [$max:expr]
-     @vis          [$v:vis]
-     @debug_format [$debug_format:tt]
-                   pub idx
-                   $($tokens:tt)*) => (
-        newtype_index!(
-            @pub          [pub]
-            @type         [$type]
-            @max          [$max]
-            @vis          [$v]
-            @debug_format [$debug_format]
-                          $($tokens)*);
-    );
-
-    // The default case is that the internal field is private
-    (@type         [$type:ident]
-     @max          [$max:expr]
-     @vis          [$v:vis]
-     @debug_format [$debug_format:tt]
-                   $($tokens:tt)*) => (
-        newtype_index!(
-            @pub          []
-            @type         [$type]
-            @max          [$max]
-            @vis          [$v]
-            @debug_format [$debug_format]
-                          $($tokens)*);
-    );
-
     // Append comma to end of derives list if it's missing
-    (@pub          [$($pub:tt)*]
-     @type         [$type:ident]
+    (@type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]
                    derive [$($derives:ident),*]
                    $($tokens:tt)*) => (
         newtype_index!(
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -228,8 +234,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // By not including the @derives marker in this list nor in the default args, we can force it
     // to come first if it exists. When encodable is custom, just use the derives list as-is.
-    (@pub          [$($pub:tt)*]
-     @type         [$type:ident]
+    (@type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]
@@ -238,7 +243,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      [$($derives,)+]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -248,8 +252,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // By not including the @derives marker in this list nor in the default args, we can force it
     // to come first if it exists. When encodable isn't custom, add serialization traits by default.
-    (@pub          [$($pub:tt)*]
-     @type         [$type:ident]
+    (@type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]
@@ -257,7 +260,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      [$($derives,)+ RustcDecodable, RustcEncodable,]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -267,8 +269,7 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // The case where no derives are added, but encodable is overridden. Don't
     // derive serialization traits
-    (@pub          [$($pub:tt)*]
-     @type         [$type:ident]
+    (@type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]
@@ -276,7 +277,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      []
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -285,15 +285,13 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
     );
 
     // The case where no derives are added, add serialization derives by default
-    (@pub          [$($pub:tt)*]
-     @type         [$type:ident]
+    (@type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
      @debug_format [$debug_format:tt]
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      [RustcDecodable, RustcEncodable,]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -303,7 +301,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // Rewrite final without comma to one that includes comma
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
@@ -311,7 +308,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $name:ident = $constant:expr) => (
         newtype_index!(
             @derives      [$($derives,)*]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -321,7 +317,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // Rewrite final const without comma to one that includes comma
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$_max:expr]
      @vis          [$v:vis]
@@ -330,7 +325,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    const $name:ident = $constant:expr) => (
         newtype_index!(
             @derives      [$($derives,)*]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -340,7 +334,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // Replace existing default for max
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$_max:expr]
      @vis          [$v:vis]
@@ -349,7 +342,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      [$($derives,)*]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -359,7 +351,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // Replace existing default for debug_format
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
@@ -368,7 +359,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
                    $($tokens:tt)*) => (
         newtype_index!(
             @derives      [$($derives,)*]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
@@ -378,7 +368,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 
     // Assign a user-defined constant
     (@derives      [$($derives:ident,)*]
-     @pub          [$($pub:tt)*]
      @type         [$type:ident]
      @max          [$max:expr]
      @vis          [$v:vis]
@@ -390,7 +379,6 @@ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
         pub const $name: $type = $type($constant);
         newtype_index!(
             @derives      [$($derives,)*]
-            @pub          [$($pub)*]
             @type         [$type]
             @max          [$max]
             @vis          [$v]
index a0b0aabf73e02b40a6beefdb36305933ceca53b6..3f8cd03660c43ab6708420f79eb03509076453cf 100644 (file)
@@ -16,7 +16,6 @@
 use rustc::mir::{ProjectionElem, Rvalue, Statement, StatementKind};
 use rustc::ty;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_data_structures::indexed_vec::Idx;
 use rustc_data_structures::sync::Lrc;
 use rustc_errors::DiagnosticBuilder;
 use syntax_pos::Span;
index 497e8e07853fbdb7e3992244b44d4f4b2e949115..290c7032388053f0b1376b35e1d22295e8a4ae58 100644 (file)
@@ -12,7 +12,6 @@
 use rustc::mir::*;
 use rustc::ty;
 use rustc_errors::DiagnosticBuilder;
-use rustc_data_structures::indexed_vec::Idx;
 use syntax_pos::Span;
 
 use borrow_check::MirBorrowckCtxt;
index 8eb052f88e124c5902c02f90953488a840d9349d..465707ecc17ddcfc58c041d083c095bd6fffb69d 100644 (file)
@@ -100,18 +100,6 @@ fn index(self) -> usize {
     }
 }
 
-impl From<usize> for LocationIndex {
-    fn from(i: usize) -> LocationIndex {
-        LocationIndex::new(i)
-    }
-}
-
-impl From<LocationIndex> for usize {
-    fn from(vid: LocationIndex) -> usize {
-        Idx::index(vid)
-    }
-}
-
 struct FactWriter<'w> {
     location_table: &'w LocationTable,
     dir: &'w Path,
index dd508084d7dec81cab13d3f2b1585ed7915db017..34e893d2a59f24970b9c92ff46c12ca5bc475143 100644 (file)
@@ -15,7 +15,6 @@
 use super::*;
 use borrow_check::nll::constraints::OutlivesConstraint;
 use dot::{self, IntoCow};
-use rustc_data_structures::indexed_vec::Idx;
 use std::borrow::Cow;
 use std::io::{self, Write};
 
index 61c99832448c595df5690083932f92377420c558..82158acc9e6ab312b73daa965ca4387f4d3c0e9d 100644 (file)
@@ -42,7 +42,6 @@
 use transform::{MirPass, MirSource};
 
 use rustc_data_structures::fx::FxHashSet;
-use rustc_data_structures::indexed_vec::Idx;
 
 macro_rules! span_mirbug {
     ($context:expr, $elem:expr, $($message:tt)*) => ({
index deb972ee04611058d6bb339bcde1b6f248ec2988..8ffce9c94926fa5437217fb2e578396c6f253c79 100644 (file)
@@ -20,7 +20,7 @@
 use rustc::ty::subst::Kind;
 use rustc::ty::{self, CanonicalTy, CanonicalVar, RegionVid, Ty, TyCtxt};
 use rustc_data_structures::fx::FxHashMap;
-use rustc_data_structures::indexed_vec::{Idx, IndexVec};
+use rustc_data_structures::indexed_vec::IndexVec;
 use std::mem;
 
 pub(super) fn sub_types<'tcx>(
index 8e99a45c87fdc3393012f58821aeeb0d51a86af9..38e0854bcd61eddabdd00c694f9efc45018d9a43 100644 (file)
@@ -95,7 +95,6 @@
 use rustc::hir::def_id::LOCAL_CRATE;
 use rustc::mir::*;
 use syntax_pos::{Span};
-use rustc_data_structures::indexed_vec::Idx;
 use rustc_data_structures::fx::FxHashMap;
 
 #[derive(Debug)]
index 92ddd8777f733eb0398566b1c45fe9f1fccd6867..154830c2e77e07277bc1fd3ea8ed7dc1fe10ed8e 100644 (file)
@@ -19,7 +19,7 @@
 use rustc::ty::{self, TyCtxt, Instance, query::TyCtxtAt};
 use rustc::ty::layout::{LayoutOf, TyLayout};
 use rustc::ty::subst::Subst;
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::indexed_vec::IndexVec;
 
 use syntax::ast::Mutability;
 use syntax::source_map::Span;
index d97c0c9b430197a53b800cfc2e6f573b15e9b6d8..1dc91cd05b33e9c7aeef0457942904c43ea47117 100644 (file)
@@ -13,7 +13,6 @@
 
 use rustc::mir::{BasicBlock, Location};
 use rustc_data_structures::indexed_set::{HybridIdxSet, IdxSet, Iter};
-use rustc_data_structures::indexed_vec::Idx;
 
 use dataflow::{BitDenotation, BlockSets, DataflowResults};
 use dataflow::move_paths::{HasMoveData, MovePathIndex};
index 1d35bb85a21a199243561b508383932342d28e78..2b5d26c748704f1655ff225b08b859d82b5f9788 100644 (file)
@@ -13,7 +13,6 @@
 use syntax::ast::NodeId;
 use rustc::mir::{BasicBlock, Mir};
 use rustc_data_structures::bitslice::bits_to_string;
-use rustc_data_structures::indexed_vec::Idx;
 
 use dot;
 use dot::IntoCow;
index 4093a6304b360d19e2d849a26c5da07db1a0165a..461285ff9bc106422dda4d97f10be82a74f61cf4 100644 (file)
@@ -16,7 +16,7 @@
 
 use rustc::{mir, ty};
 use rustc::ty::layout::{self, Size, LayoutOf, TyLayout, HasDataLayout, IntegerExt};
-use rustc_data_structures::indexed_vec::Idx;
+
 use rustc::mir::interpret::{
     GlobalId, AllocId,
     ConstValue, Pointer, Scalar, ScalarMaybeUndef,
index 51a4294452719656c0e14d0a56b48c7b56184ea7..d01593ca5e91c6a1878d23892a7cff56708b34a3 100644 (file)
@@ -18,7 +18,6 @@
 use rustc::mir;
 use rustc::ty::{self, Ty};
 use rustc::ty::layout::{self, Size, Align, LayoutOf, TyLayout, HasDataLayout};
-use rustc_data_structures::indexed_vec::Idx;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
 
 use rustc::mir::interpret::{
index e2b1a255eaca29fba90b48c664c84f5b27b2e5c0..4d19e9dfbf98abd3623ed81fb2fa6070c6b26248 100644 (file)
@@ -26,7 +26,7 @@
 use transform::{MirPass, MirSource};
 use syntax::source_map::{Span, DUMMY_SP};
 use rustc::ty::subst::Substs;
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::indexed_vec::IndexVec;
 use rustc::ty::ParamEnv;
 use rustc::ty::layout::{
     LayoutOf, TyLayout, LayoutError,
@@ -133,7 +133,6 @@ fn use_ecx<F, T>(
         self.ecx.tcx.span = source_info.span;
         let lint_root = match self.mir.source_scope_local_data {
             ClearCrossCrate::Set(ref ivs) => {
-                use rustc_data_structures::indexed_vec::Idx;
                 //FIXME(#51314): remove this check
                 if source_info.scope.index() >= ivs.len() {
                     return None;
index 225de03a329651d252e4bc7ee32aeaf2479bbc78..bf538112e41ed26ec434092858648a6df1081fb1 100644 (file)
@@ -19,7 +19,6 @@
 use rustc::mir::*;
 use rustc::util::nodemap::FxHashMap;
 use rustc_data_structures::indexed_set::IdxSet;
-use rustc_data_structures::indexed_vec::Idx;
 use transform::{MirPass, MirSource};
 use util::patch::MirPatch;
 use util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop};
index 050901b9b508a7ab7f3cca1c8e8b7eed7dfd3b17..81fc235c23346aa1515951cdc573ca612b7ee0de 100644 (file)
@@ -16,7 +16,7 @@
 
 use rustc_data_structures::bitvec::BitArray;
 use rustc_data_structures::indexed_set::IdxSet;
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::fx::FxHashSet;
 use rustc::hir;
 use rustc::hir::def_id::DefId;
index eda7de0fd79d48da9ade13918219acb914d4af23..9faaeea3f5b70038073c9e8ae8df3c6862f35310 100644 (file)
@@ -15,7 +15,6 @@
 use rustc::ty::{self, TyCtxt};
 use rustc::mir::{self, Mir, Location};
 use rustc_data_structures::indexed_set::IdxSet;
-use rustc_data_structures::indexed_vec::Idx;
 use transform::{MirPass, MirSource};
 
 use dataflow::{do_dataflow, DebugFormatted};
index 22e2b1b0b09c9945d6a313d9f7f764502e9f3472..0b883f68bff40f464062acff65b5af2b17026917 100644 (file)
@@ -15,8 +15,6 @@
 use std::fmt::Debug;
 use std::io::{self, Write};
 
-use rustc_data_structures::indexed_vec::Idx;
-
 use super::pretty::dump_mir_def_ids;
 
 /// Write a graphviz DOT graph of a list of MIRs.