diff --git a/Cargo.lock b/Cargo.lock index 3c49d6f4d2c..97e8e715c1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3342,7 +3342,6 @@ dependencies = [ name = "rustc_codegen_llvm" version = "0.0.0" dependencies = [ - "rustc_index", "rustc_llvm", ] @@ -3519,6 +3518,7 @@ dependencies = [ "log", "rustc", "rustc_data_structures", + "rustc_index", "rustc_target", "syntax", "syntax_pos", @@ -3687,6 +3687,7 @@ dependencies = [ "bitflags", "log", "rustc_data_structures", + "rustc_index", "serialize", "syntax_pos", ] @@ -3735,6 +3736,7 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_errors", + "rustc_index", "rustc_target", "smallvec", "syntax", @@ -4281,6 +4283,7 @@ dependencies = [ "arena", "cfg-if", "rustc_data_structures", + "rustc_index", "rustc_macros", "scoped-tls", "serialize", diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index b922910c4d7..5a5919d7866 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -26,12 +26,12 @@ macro_rules! arena_types { [] steal_mir: rustc::ty::steal::Steal>, [] mir: rustc::mir::Body<$tcx>, [] steal_promoted: rustc::ty::steal::Steal< - rustc_data_structures::indexed_vec::IndexVec< + rustc_index::vec::IndexVec< rustc::mir::Promoted, rustc::mir::Body<$tcx> > >, - [] promoted: rustc_data_structures::indexed_vec::IndexVec< + [] promoted: rustc_index::vec::IndexVec< rustc::mir::Promoted, rustc::mir::Body<$tcx> >, diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index acfdc91523f..0c56fc7914b 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -1,7 +1,7 @@ use errors::Diagnostic; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use smallvec::SmallVec; use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, Ordering}; use std::env; @@ -26,7 +26,7 @@ pub struct DepGraph { data: Option>, } -newtype_index! { +rustc_index::newtype_index! { pub struct DepNodeIndex { .. } } diff --git a/src/librustc/dep_graph/serialized.rs b/src/librustc/dep_graph/serialized.rs index b64f71ed908..4302195755e 100644 --- a/src/librustc/dep_graph/serialized.rs +++ b/src/librustc/dep_graph/serialized.rs @@ -2,9 +2,9 @@ use crate::dep_graph::DepNode; use crate::ich::Fingerprint; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; -newtype_index! { +rustc_index::newtype_index! { pub struct SerializedDepNodeIndex { .. } } diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index d0bdc149131..13200b38f2c 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -1,9 +1,9 @@ use crate::ty::{self, TyCtxt}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::fmt; use std::u32; -newtype_index! { +rustc_index::newtype_index! { pub struct CrateId { ENCODABLE = custom } @@ -87,7 +87,7 @@ impl fmt::Display for CrateNum { impl rustc_serialize::UseSpecializedEncodable for CrateNum {} impl rustc_serialize::UseSpecializedDecodable for CrateNum {} -newtype_index! { +rustc_index::newtype_index! { /// A DefIndex is an index into the hir-map for a crate, identifying a /// particular definition. It should really be considered an interned /// shorthand for a particular DefPath. diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 6f51e05881b..4310bafd781 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -52,7 +52,7 @@ use crate::util::common::FN_OUTPUT_NAME; use crate::util::nodemap::{DefIdMap, NodeMap}; use errors::Applicability; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::thin_vec::ThinVec; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 540d456daf3..1a970c7a2c1 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -5,7 +5,7 @@ use crate::hir::map::HirEntryMap; use crate::hir::def_id::{LOCAL_CRATE, CrateNum}; use crate::hir::intravisit::{Visitor, NestedVisitorMap}; use rustc_data_structures::svh::Svh; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use crate::ich::Fingerprint; use crate::middle::cstore::CrateStore; use crate::session::CrateDisambiguator; diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 187bc593324..71bf230e37d 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -11,7 +11,7 @@ use crate::session::CrateDisambiguator; use crate::util::nodemap::NodeMap; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::{IndexVec}; +use rustc_index::vec::{IndexVec}; use rustc_data_structures::stable_hasher::StableHasher; use std::borrow::Borrow; use std::fmt::Write; diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 42a4a9909f8..14c04762042 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -17,7 +17,7 @@ use crate::util::common::time; use rustc_target::spec::abi::Abi; use rustc_data_structures::svh::Svh; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use syntax::ast::{self, Name, NodeId}; use syntax::source_map::Spanned; use syntax::ext::base::MacroKind; diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 4e8b4337cc6..9ae661f0952 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -122,9 +122,9 @@ impl fmt::Display for HirId { // Hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module. mod item_local_id_inner { - use rustc_data_structures::indexed_vec::Idx; + use rustc_index::vec::Idx; use rustc_macros::HashStable; - newtype_index! { + rustc_index::newtype_index! { /// An `ItemLocalId` uniquely identifies something within a given "item-like"; /// that is, within a `hir::Item`, `hir::TraitItem`, or `hir::ImplItem`. There is no /// guarantee that the numerical value of a given `ItemLocalId` corresponds to diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index 2ea1317a94f..b9474f869ee 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -18,7 +18,7 @@ use crate::ty::{self, BoundVar, InferConst, List, Ty, TyCtxt, TypeFlags}; use crate::ty::flags::FlagComputation; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use smallvec::SmallVec; impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index 4e442608f0e..562a463ded8 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -25,7 +25,7 @@ use crate::infer::{InferCtxt, RegionVariableOrigin, TypeVariableOrigin, TypeVari use crate::infer::{ConstVariableOrigin, ConstVariableOriginKind}; use crate::infer::region_constraints::MemberConstraint; use crate::mir::interpret::ConstValue; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_macros::HashStable; use rustc_serialize::UseSpecializedDecodable; use smallvec::SmallVec; diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 18c1b41d5bb..95b6a8bc843 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -17,8 +17,8 @@ use crate::infer::region_constraints::{Constraint, RegionConstraintData}; use crate::infer::InferCtxtBuilder; use crate::infer::{InferCtxt, InferOk, InferResult}; use crate::mir::interpret::ConstValue; -use rustc_data_structures::indexed_vec::Idx; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::Idx; +use rustc_index::vec::IndexVec; use std::fmt::Debug; use syntax_pos::DUMMY_SP; use crate::traits::query::{Fallible, NoSolution}; diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 6282fde59ca..f11f94c428e 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -19,7 +19,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{ Direction, Graph, NodeIndex, INCOMING, OUTGOING, }; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use smallvec::SmallVec; use std::fmt; use syntax_pos::Span; diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 21904edb309..b4b4d1fe3e1 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -7,7 +7,7 @@ use super::unify_key; use super::{MiscVariable, RegionVariableOrigin, SubregionOrigin}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; use crate::hir::def_id::DefId; diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index c1435551a59..7b5aea8ac98 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -5,7 +5,7 @@ use crate::ty::layout::{LayoutError, Pointer, SizeSkeleton, VariantIdx}; use crate::ty::query::Providers; use rustc_target::spec::abi::Abi::RustIntrinsic; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use syntax_pos::{Span, sym}; use crate::hir::intravisit::{self, Visitor, NestedVisitorMap}; use crate::hir; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 05e4d11c3f9..9ff205228a5 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -16,8 +16,8 @@ use crate::util::nodemap::{FxHashMap, FxHashSet}; use crate::ty::{self, DefIdTree, TyCtxt}; use crate::ty::query::Providers; -use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_index::vec::Idx; use rustc_macros::HashStable; use syntax::source_map; use syntax_pos::{Span, DUMMY_SP}; @@ -131,7 +131,7 @@ pub enum ScopeData { Remainder(FirstStatementIndex) } -newtype_index! { +rustc_index::newtype_index! { /// Represents a subscope of `block` for a binding that is introduced /// by `block.stmts[first_statement_index]`. Such subscopes represent /// a suffix of the block. Note that each subscope does not include diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index d8d3383903d..9b413667418 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 00d7400a651..6664e16895a 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -24,7 +24,7 @@ use rustc_index::bit_set::BitMatrix; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::dominators::{dominators, Dominators}; use rustc_data_structures::graph::{self, GraphPredecessors, GraphSuccessors}; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::MappedReadGuard; use rustc_macros::HashStable; @@ -581,7 +581,7 @@ impl BorrowKind { /////////////////////////////////////////////////////////////////////////// // Variables and temps -newtype_index! { +rustc_index::newtype_index! { pub struct Local { derive [HashStable] DEBUG_FORMAT = "_{}", @@ -994,7 +994,7 @@ pub struct UpvarDebuginfo { /////////////////////////////////////////////////////////////////////////// // BasicBlock -newtype_index! { +rustc_index::newtype_index! { pub struct BasicBlock { derive [HashStable] DEBUG_FORMAT = "bb{}", @@ -1832,7 +1832,7 @@ static_assert_size!(PlaceElem<'_>, 16); /// need neither the `V` parameter for `Index` nor the `T` for `Field`. pub type ProjectionKind = ProjectionElem<(), ()>; -newtype_index! { +rustc_index::newtype_index! { pub struct Field { derive [HashStable] DEBUG_FORMAT = "field[{}]" @@ -2047,7 +2047,7 @@ impl Debug for PlaceBase<'_> { /////////////////////////////////////////////////////////////////////////// // Scopes -newtype_index! { +rustc_index::newtype_index! { pub struct SourceScope { derive [HashStable] DEBUG_FORMAT = "scope[{}]", @@ -2586,7 +2586,7 @@ impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection { } } -newtype_index! { +rustc_index::newtype_index! { pub struct Promoted { derive [HashStable] DEBUG_FORMAT = "promoted[{}]" @@ -2743,7 +2743,7 @@ pub struct UnsafetyCheckResult { pub unsafe_blocks: Lrc<[(hir::HirId, bool)]>, } -newtype_index! { +rustc_index::newtype_index! { pub struct GeneratorSavedLocal { derive [HashStable] DEBUG_FORMAT = "_{}", diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index 4b1558592ae..e463810b7af 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -132,7 +132,7 @@ rustc_queries! { cache_on_disk_if { key.is_local() } load_cached(tcx, id) { let promoted: Option< - rustc_data_structures::indexed_vec::IndexVec< + rustc_index::vec::IndexVec< crate::mir::Promoted, crate::mir::Body<'tcx> >> = tcx.queries.on_disk_cache.try_load_query_result(tcx, id); diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 6c5d9a6dfdf..34c650b06a5 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -52,7 +52,7 @@ use smallvec::SmallVec; use rustc_data_structures::stable_hasher::{ HashStable, StableHasher, StableVec, hash_stable_hashmap, }; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_data_structures::sharded::ShardedHashMap; use rustc_data_structures::sync::{Lrc, Lock, WorkerLocal}; use std::any::Any; @@ -777,7 +777,7 @@ impl<'a, 'tcx> HashStable> for TypeckTables<'tcx> { } } -newtype_index! { +rustc_index::newtype_index! { pub struct UserTypeAnnotationIndex { derive [HashStable] DEBUG_FORMAT = "UserType({})", diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index eb2e1de7787..6b22ded49f3 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -18,8 +18,8 @@ use crate::mir::{GeneratorLayout, GeneratorSavedLocal}; use crate::ty::GeneratorSubsts; use crate::ty::subst::Subst; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_index::vec::{IndexVec, Idx}; pub use rustc_target::abi::*; use rustc_target::spec::{HasTargetSpec, abi::Abi as SpecAbi}; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 731aca854a4..269f87c441a 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -51,8 +51,8 @@ use syntax_pos::Span; use smallvec; use rustc_data_structures::fx::FxIndexMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; +use rustc_index::vec::{Idx, IndexVec}; use crate::hir; @@ -1536,7 +1536,7 @@ impl<'tcx> InstantiatedPredicates<'tcx> { } } -newtype_index! { +rustc_index::newtype_index! { /// "Universes" are used during type- and trait-checking in the /// presence of `for<..>` binders to control what sets of names are /// visible. Universes are arranged into a tree: the root universe diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index e5c3a8402a7..863721a5b4b 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -43,7 +43,7 @@ use crate::util::profiling::ProfileCategory::*; use rustc_data_structures::svh::Svh; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::fx::{FxIndexMap, FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::StableVec; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index c20e7586889..97fafe341a3 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -15,7 +15,7 @@ use errors::Diagnostic; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::thin_vec::ThinVec; use rustc_data_structures::sync::{Lrc, Lock, HashMapExt, Once}; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use rustc_serialize::{ Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder, UseSpecializedDecodable, UseSpecializedEncodable, opaque, diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 42d632d120e..6b0df7fb92a 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -9,7 +9,7 @@ use crate::mir::interpret::ConstValue; use crate::ty::{self, Lift, Ty, TyCtxt, InferConst}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::print::{FmtPrinter, Printer}; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use smallvec::SmallVec; use crate::mir::interpret; diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 91479751ef4..239c5796825 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -8,7 +8,7 @@ use crate::infer::canonical::Canonical; use crate::mir::interpret::ConstValue; use crate::middle::region; use polonius_engine::Atom; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_macros::HashStable; use crate::ty::subst::{InternalSubsts, Subst, SubstsRef, GenericArg, GenericArgKind}; use crate::ty::{self, AdtDef, Discr, DefIdTree, TypeFlags, Ty, TyCtxt, TypeFoldable}; @@ -1165,7 +1165,7 @@ impl<'tcx> ParamConst { } } -newtype_index! { +rustc_index::newtype_index! { /// A [De Bruijn index][dbi] is a standard means of representing /// regions (and perhaps later types) in a higher-ranked setting. In /// particular, imagine a type like this: @@ -1349,7 +1349,7 @@ pub struct FloatVid { pub index: u32, } -newtype_index! { +rustc_index::newtype_index! { pub struct RegionVid { DEBUG_FORMAT = custom, } @@ -1376,7 +1376,7 @@ pub enum InferTy { FreshFloatTy(u32), } -newtype_index! { +rustc_index::newtype_index! { pub struct BoundVar { .. } } diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 540ab2a352a..98efa6a5804 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -12,7 +12,6 @@ test = false [dependencies] rustc_llvm = { path = "../librustc_llvm" } -rustc_index = { path = "../librustc_index" } [features] # This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm` diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index 45af55a7be7..bdb7467a101 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -12,7 +12,7 @@ use libc::c_uint; use syntax_pos::Pos; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use syntax_pos::BytePos; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 4efa1993d43..e0e0cd5f739 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -26,7 +26,7 @@ use rustc::mir; use rustc::session::config::{self, DebugInfo}; use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_codegen_ssa::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind, FunctionDebugContextData, type_names}; diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 2a63011c2f5..309a17a01e3 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -31,6 +31,7 @@ extern crate libc; #[macro_use] extern crate rustc; extern crate rustc_target; #[macro_use] extern crate rustc_data_structures; +extern crate rustc_index; extern crate rustc_incremental; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index d634b73430a..9078f77f1f7 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -13,7 +13,7 @@ use rustc::ty::{TyCtxt, SymbolName}; use rustc::ty::query::Providers; use rustc::ty::subst::SubstsRef; use rustc::util::nodemap::{FxHashMap, DefIdMap}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use syntax::ext::allocator::ALLOCATOR_METHODS; pub type ExportedSymbols = FxHashMap< diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 90ed629bbc6..d11d8911a93 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -29,7 +29,7 @@ use rustc::util::common::{time, print_time_passes_entry, set_time_depth, time_de use rustc::session::config::{self, EntryFnType, Lto}; use rustc::session::Session; use rustc::util::nodemap::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_codegen_utils::{symbol_names_test, check_for_rustc_errors_attr}; use rustc::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA}; use crate::mir::place::PlaceRef; diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index 9dc3d956aaf..ea1cf926fcc 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -3,7 +3,7 @@ use rustc_index::bit_set::BitSet; use rustc_data_structures::graph::dominators::Dominators; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc::mir::{self, Location, TerminatorKind}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; use rustc::mir::traversal; diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 7ebdfbdcdeb..3a1d0a25775 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -1,4 +1,4 @@ -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc::middle::lang_items; use rustc::ty::{self, Ty, TypeFoldable, Instance}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, FnTypeExt}; diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 9cfe410fcc5..d06359ab0ce 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -1,6 +1,6 @@ use rustc::mir::interpret::ErrorHandled; use rustc::mir; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, HasTyCtxt}; use syntax::source_map::Span; diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 7cf8a69cee3..2a563e8290e 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -14,7 +14,7 @@ use syntax::symbol::kw; use std::iter; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use self::analyze::CleanupKind; use self::place::PlaceRef; diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index 9c16b864ef2..e75f247da96 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -3,7 +3,7 @@ use crate::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, Vari use rustc::hir::def_id::CrateNum; use rustc::mir; use rustc::ty::{self, Ty, Instance}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use syntax::ast::Name; use syntax_pos::{SourceFile, Span}; diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs index 41e6b72953e..29a8a98d229 100644 --- a/src/librustc_data_structures/graph/dominators/mod.rs +++ b/src/librustc_data_structures/graph/dominators/mod.rs @@ -4,7 +4,7 @@ //! Rice Computer Science TS-06-33870 //! -use super::super::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use super::iterate::reverse_post_order; use super::ControlFlowGraph; diff --git a/src/librustc_data_structures/graph/iterate/mod.rs b/src/librustc_data_structures/graph/iterate/mod.rs index 999c5df7b86..e268b281744 100644 --- a/src/librustc_data_structures/graph/iterate/mod.rs +++ b/src/librustc_data_structures/graph/iterate/mod.rs @@ -1,4 +1,4 @@ -use super::super::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use super::{DirectedGraph, WithNumNodes, WithSuccessors, WithStartNode}; use rustc_index::bit_set::BitSet; diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs index 0a607659f3e..37335799d19 100644 --- a/src/librustc_data_structures/graph/mod.rs +++ b/src/librustc_data_structures/graph/mod.rs @@ -1,4 +1,4 @@ -use super::indexed_vec::Idx; +use rustc_index::vec::Idx; pub mod dominators; pub mod implementation; diff --git a/src/librustc_data_structures/graph/scc/mod.rs b/src/librustc_data_structures/graph/scc/mod.rs index 23a1a2a90a4..c214f66cd15 100644 --- a/src/librustc_data_structures/graph/scc/mod.rs +++ b/src/librustc_data_structures/graph/scc/mod.rs @@ -6,7 +6,7 @@ use crate::fx::FxHashSet; use crate::graph::{DirectedGraph, WithNumNodes, WithNumEdges, WithSuccessors, GraphSuccessors}; use crate::graph::vec_graph::VecGraph; -use crate::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use std::ops::Range; #[cfg(test)] diff --git a/src/librustc_data_structures/graph/vec_graph/mod.rs b/src/librustc_data_structures/graph/vec_graph/mod.rs index 19c61f2680d..aad5944dcd0 100644 --- a/src/librustc_data_structures/graph/vec_graph/mod.rs +++ b/src/librustc_data_structures/graph/vec_graph/mod.rs @@ -1,4 +1,4 @@ -use crate::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use crate::graph::{DirectedGraph, WithNumNodes, WithNumEdges, WithSuccessors, GraphSuccessors}; #[cfg(test)] diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 6a4602da36d..474a42644d9 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -37,7 +37,6 @@ extern crate libc; extern crate cfg_if; pub use rustc_serialize::hex::ToHex; -pub use rustc_index::{indexed_vec, newtype_index}; #[inline(never)] #[cold] diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 1c7109fe500..cfccef67fe7 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -138,7 +138,7 @@ pub struct ObligationForest { /// call to `compress`. /// /// `usize` indices are used here and throughout this module, rather than - /// `newtype_index!` indices, because this code is hot enough that the + /// `rustc_index::newtype_index!` indices, because this code is hot enough that the /// `u32`-to-`usize` conversions that would be required are significant, /// and space considerations are not important. nodes: Vec>, diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index 7f17a1aed62..ee4f6a5e785 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -2,7 +2,7 @@ use std::hash::{Hash, Hasher, BuildHasher}; use std::mem; use smallvec::SmallVec; use crate::sip128::SipHasher128; -use crate::indexed_vec; +use rustc_index::vec; use rustc_index::bit_set; /// When hashing something that ends up affecting properties like symbol names, @@ -429,7 +429,7 @@ impl HashStable for ::std::mem::Discriminant { } } -impl HashStable for indexed_vec::IndexVec +impl HashStable for vec::IndexVec where T: HashStable, { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { @@ -441,14 +441,14 @@ impl HashStable for indexed_vec::IndexVec HashStable for bit_set::BitSet +impl HashStable for bit_set::BitSet { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { self.words().hash_stable(ctx, hasher); } } -impl HashStable +impl HashStable for bit_set::BitMatrix { fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { diff --git a/src/librustc_data_structures/vec_linked_list.rs b/src/librustc_data_structures/vec_linked_list.rs index 0fb80600318..7744c30655d 100644 --- a/src/librustc_data_structures/vec_linked_list.rs +++ b/src/librustc_data_structures/vec_linked_list.rs @@ -1,4 +1,4 @@ -use crate::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; pub fn iter( first: Option, diff --git a/src/librustc_data_structures/work_queue.rs b/src/librustc_data_structures/work_queue.rs index 2c0e2261fee..af63b18e9e9 100644 --- a/src/librustc_data_structures/work_queue.rs +++ b/src/librustc_data_structures/work_queue.rs @@ -1,5 +1,5 @@ use rustc_index::bit_set::BitSet; -use crate::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::collections::VecDeque; /// A work queue is a handy data structure for tracking work left to diff --git a/src/librustc_index/bit_set.rs b/src/librustc_index/bit_set.rs index fe8ef642430..9c96645ccf9 100644 --- a/src/librustc_index/bit_set.rs +++ b/src/librustc_index/bit_set.rs @@ -1,4 +1,4 @@ -use crate::indexed_vec::{Idx, IndexVec}; +use crate::vec::{Idx, IndexVec}; use smallvec::SmallVec; use std::fmt; use std::iter; diff --git a/src/librustc_index/lib.rs b/src/librustc_index/lib.rs index 5d7e0d82e78..ad242dfd2e0 100644 --- a/src/librustc_index/lib.rs +++ b/src/librustc_index/lib.rs @@ -3,5 +3,5 @@ #![feature(test)] #![feature(fn_traits)] -pub mod indexed_vec; +pub mod vec; pub mod bit_set; diff --git a/src/librustc_index/indexed_vec.rs b/src/librustc_index/vec.rs similarity index 100% rename from src/librustc_index/indexed_vec.rs rename to src/librustc_index/vec.rs diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 041d0aaead9..a61a314d549 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -15,3 +15,4 @@ rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 150719c1dbc..3d14a78c33f 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -7,7 +7,7 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc::ty::layout::{self, IntegerExt, LayoutOf, VariantIdx, SizeSkeleton}; use rustc::{lint, util}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use util::nodemap::FxHashSet; use lint::{LateContext, LintContext, LintArray}; use lint::{LintPass, LateLintPass}; diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index 5bf4067431f..d3619b2f5de 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -6,7 +6,7 @@ use rustc::hir::def_id::{CrateNum, DefIndex}; use rustc::hir::map::definitions::DefPathTable; use rustc::middle::cstore::{DepKind, ExternCrate, MetadataLoader}; use rustc::mir::interpret::AllocDecodingState; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc::util::nodemap::{FxHashMap, NodeMap}; use rustc_data_structures::sync::{Lrc, RwLock, Lock}; diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 3c6a1c47446..9fcc3101545 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -3,7 +3,7 @@ use crate::cstore::{self, CrateMetadata, MetadataBlob, NativeLibrary, ForeignModule}; use crate::schema::*; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::sync::{Lrc, ReadGuard}; use rustc::hir::map::{DefKey, DefPath, DefPathData, DefPathHash}; use rustc::hir; diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 9beeacbe72d..a86bc283ced 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -8,7 +8,7 @@ use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefIndex, DefId, LocalDefId, use rustc::hir::GenericParamKind; use rustc::hir::map::definitions::DefPathTable; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc::middle::dependency_format::Linkage; use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel, metadata_symbol_name}; diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 4be70c62035..2069adea021 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -11,7 +11,7 @@ use rustc::session::CrateDisambiguator; use rustc::session::config::SymbolManglingVersion; use rustc::ty::{self, Ty, ReprOptions}; use rustc_target::spec::{PanicStrategy, TargetTriple}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::svh::Svh; use syntax::{ast, attr}; diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index 3dcd1f56209..7dd1db3b7bd 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -8,7 +8,7 @@ use rustc::mir::visit::{PlaceContext, Visitor, NonUseContext, MutatingUseContext use rustc::mir::{self, Location, Body, Local}; use rustc::ty::{RegionVid, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_index::bit_set::BitSet; use std::fmt; use std::ops::Index; diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs index 7d5d58ed284..ef459ef0c1b 100644 --- a/src/librustc_mir/borrow_check/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/conflict_errors.rs @@ -7,7 +7,7 @@ use rustc::mir::{ }; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_errors::{Applicability, DiagnosticBuilder}; use syntax_pos::Span; use syntax::source_map::DesugaringKind; diff --git a/src/librustc_mir/borrow_check/location.rs b/src/librustc_mir/borrow_check/location.rs index cc44dc3f5d4..9e94317b87e 100644 --- a/src/librustc_mir/borrow_check/location.rs +++ b/src/librustc_mir/borrow_check/location.rs @@ -1,5 +1,5 @@ use rustc::mir::{BasicBlock, Location, Body}; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; /// Maps between a MIR Location, which identifies a particular /// statement within a basic block, to a "rich location", which @@ -17,7 +17,7 @@ crate struct LocationTable { statements_before_block: IndexVec, } -newtype_index! { +rustc_index::newtype_index! { pub struct LocationIndex { DEBUG_FORMAT = "LocationIndex({})" } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index b9009ac5a51..cfa211ad5af 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -21,7 +21,7 @@ use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder}; use rustc_index::bit_set::BitSet; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::graph::dominators::Dominators; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use smallvec::SmallVec; use std::collections::BTreeMap; diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index d6b91373ab8..8ab4020394f 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -5,7 +5,7 @@ use rustc::mir::{ Mutability, Place, PlaceRef, PlaceBase, ProjectionElem, Static, StaticKind }; use rustc::ty::{self, Ty, TyCtxt}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use syntax_pos::Span; use syntax_pos::symbol::kw; diff --git a/src/librustc_mir/borrow_check/nll/constraints/graph.rs b/src/librustc_mir/borrow_check/nll/constraints/graph.rs index b5630251e58..b6a9a7ee657 100644 --- a/src/librustc_mir/borrow_check/nll/constraints/graph.rs +++ b/src/librustc_mir/borrow_check/nll/constraints/graph.rs @@ -4,7 +4,7 @@ use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConst use rustc::mir::ConstraintCategory; use rustc::ty::RegionVid; use rustc_data_structures::graph; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use syntax_pos::DUMMY_SP; /// The construct graph organizes the constraints by their end-points. diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs index 6121ed0cf0d..93113753c63 100644 --- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs +++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs @@ -2,7 +2,7 @@ use crate::borrow_check::nll::type_check::Locations; use rustc::mir::ConstraintCategory; use rustc::ty::RegionVid; use rustc_data_structures::graph::scc::Sccs; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use std::fmt; use std::ops::Index; @@ -100,13 +100,13 @@ impl fmt::Debug for OutlivesConstraint { } } -newtype_index! { +rustc_index::newtype_index! { pub struct OutlivesConstraintIndex { DEBUG_FORMAT = "OutlivesConstraintIndex({})" } } -newtype_index! { +rustc_index::newtype_index! { pub struct ConstraintSccIndex { DEBUG_FORMAT = "ConstraintSccIndex({})" } diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/nll/facts.rs index f0beb4d3ae3..13e5769c5be 100644 --- a/src/librustc_mir/borrow_check/nll/facts.rs +++ b/src/librustc_mir/borrow_check/nll/facts.rs @@ -4,7 +4,7 @@ use polonius_engine::AllFacts as PoloniusAllFacts; use polonius_engine::Atom; use rustc::mir::Local; use rustc::ty::{RegionVid, TyCtxt}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::error::Error; use std::fmt::Debug; use std::fs::{self, File}; diff --git a/src/librustc_mir/borrow_check/nll/member_constraints.rs b/src/librustc_mir/borrow_check/nll/member_constraints.rs index b5e2e111f38..fd195873a55 100644 --- a/src/librustc_mir/borrow_check/nll/member_constraints.rs +++ b/src/librustc_mir/borrow_check/nll/member_constraints.rs @@ -2,7 +2,7 @@ use crate::rustc::ty::{self, Ty}; use rustc::hir::def_id::DefId; use rustc::infer::region_constraints::MemberConstraint; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use std::hash::Hash; use std::ops::Index; use syntax_pos::Span; @@ -51,7 +51,7 @@ crate struct NllMemberConstraint<'tcx> { end_index: usize, } -newtype_index! { +rustc_index::newtype_index! { crate struct NllMemberConstraintIndex { DEBUG_FORMAT = "MemberConstraintIndex({})" } diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index 1ff3228afa3..b2e5751b902 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -14,7 +14,7 @@ use rustc::infer::InferCtxt; use rustc::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, Local, Location, Body, LocalKind, BasicBlock, Promoted}; use rustc::ty::{self, RegionKind, RegionVid}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_errors::Diagnostic; use std::fmt::Debug; use std::env; diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index e29e9232012..6d3f2e56638 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -12,7 +12,7 @@ use rustc::infer::InferCtxt; use rustc::infer::NLLRegionVariableOrigin; use rustc::mir::{ConstraintCategory, Location, Body}; use rustc::ty::{self, RegionVid}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_errors::DiagnosticBuilder; use std::collections::VecDeque; use syntax::errors::Applicability; diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index 750a1324fae..7f0e97c9ae4 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -3,7 +3,7 @@ use crate::borrow_check::nll::ToRegionVid; use crate::borrow_check::Upvar; use rustc::mir::{Local, Body}; use rustc::ty::{RegionVid, TyCtxt}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use syntax::source_map::Span; use syntax_pos::symbol::Symbol; diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 030839cdb7e..38df8035397 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -32,7 +32,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::graph::WithSuccessors; use rustc_data_structures::graph::scc::Sccs; use rustc_data_structures::graph::vec_graph::VecGraph; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_errors::{Diagnostic, DiagnosticBuilder}; use syntax_pos::Span; diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index 4a56af09d88..6acbff76bdc 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -2,8 +2,8 @@ use rustc::mir::{BasicBlock, Location, Body}; use rustc::ty::{self, RegionVid}; use rustc_index::bit_set::{HybridBitSet, SparseBitMatrix}; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::Idx; +use rustc_index::vec::IndexVec; use std::fmt::Debug; use std::rc::Rc; @@ -116,13 +116,13 @@ impl RegionValueElements { } } -newtype_index! { +rustc_index::newtype_index! { /// A single integer representing a `Location` in the MIR control-flow /// graph. Constructed efficiently from `RegionValueElements`. pub struct PointIndex { DEBUG_FORMAT = "PointIndex({})" } } -newtype_index! { +rustc_index::newtype_index! { /// A single integer representing a `ty::Placeholder`. pub struct PlaceholderIndex { DEBUG_FORMAT = "PlaceholderIndex({})" } } diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index c479c38f30c..cd13803875b 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -3,7 +3,7 @@ use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable}; use rustc::mir::{Location, Body, Promoted}; use rustc::mir::visit::{MutVisitor, TyContext}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; /// Replaces all free regions appearing in the MIR with fresh /// inference variables, returning the number of variables created. diff --git a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs index 99661b1f737..d74dd0fc0f5 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs @@ -12,7 +12,7 @@ use rustc::infer::LateBoundRegionConversionTime; use rustc::mir::*; use rustc::ty::Ty; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use syntax_pos::Span; use super::{Locations, TypeChecker}; diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs index 049d83bb22f..7689ece7066 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs @@ -2,7 +2,7 @@ use crate::borrow_check::nll::region_infer::values::{PointIndex, RegionValueElem use crate::util::liveness::{categorize, DefUse}; use rustc::mir::visit::{PlaceContext, Visitor}; use rustc::mir::{Body, Local, Location}; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_data_structures::vec_linked_list as vll; /// A map that cross references each local with the locations where it @@ -44,7 +44,7 @@ struct Appearance { next: Option, } -newtype_index! { +rustc_index::newtype_index! { pub struct AppearanceIndex { .. } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index fa326062fe2..b24ba596d7e 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -43,7 +43,7 @@ use rustc::ty::{ UserTypeAnnotationIndex, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use rustc::ty::layout::VariantIdx; use std::rc::Rc; use std::{fmt, iter, mem}; diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 7053bdca259..b4470582b71 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -21,7 +21,7 @@ use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::{InternalSubsts, SubstsRef, Subst}; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_errors::DiagnosticBuilder; use std::iter; diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index 09b33c6654a..17308119339 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -8,7 +8,7 @@ use rustc::mir::interpret::{PanicInfo::BoundsCheck}; use rustc::mir::*; use rustc::ty::{CanonicalUserTypeAnnotation, Variance}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr`, yielding a place that we can move from etc. diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 7dfe98cbebf..b4d93a4493f 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -1,7 +1,7 @@ //! See docs in `build/expr/mod.rs`. use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, Builder}; diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 17932ae8557..9c30d950990 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -14,7 +14,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::subst::Subst; use rustc::util::nodemap::HirIdMap; use rustc_target::spec::PanicStrategy; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use std::u32; use rustc_target::spec::abi::Abi; use syntax::attr::{self, UnwindAttr}; @@ -455,7 +455,7 @@ struct CFG<'tcx> { basic_blocks: IndexVec>, } -newtype_index! { +rustc_index::newtype_index! { pub struct ScopeId { .. } } diff --git a/src/librustc_mir/dataflow/generic.rs b/src/librustc_mir/dataflow/generic.rs index 10d0627a9fb..6f598469e9d 100644 --- a/src/librustc_mir/dataflow/generic.rs +++ b/src/librustc_mir/dataflow/generic.rs @@ -21,7 +21,7 @@ use std::ops; use rustc::mir::{self, traversal, BasicBlock, Location}; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_data_structures::work_queue::WorkQueue; use crate::dataflow::BottomValue; diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 44f6c263fed..5e64144df2c 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -7,7 +7,7 @@ use rustc::ty::RegionVid; use rustc_index::bit_set::BitSet; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use crate::dataflow::{BitDenotation, BottomValue, GenKillSet}; use crate::borrow_check::nll::region_infer::RegionInferenceContext; @@ -16,7 +16,7 @@ use crate::borrow_check::places_conflict; use std::rc::Rc; -newtype_index! { +rustc_index::newtype_index! { pub struct BorrowIndex { DEBUG_FORMAT = "bw{}" } diff --git a/src/librustc_mir/dataflow/impls/indirect_mutation.rs b/src/librustc_mir/dataflow/impls/indirect_mutation.rs index 7d20248ebd1..535b803b85f 100644 --- a/src/librustc_mir/dataflow/impls/indirect_mutation.rs +++ b/src/librustc_mir/dataflow/impls/indirect_mutation.rs @@ -1,7 +1,7 @@ use rustc::mir::visit::Visitor; use rustc::mir::{self, Local, Location}; use rustc::ty::{self, TyCtxt}; -use rustc_data_structures::bit_set::BitSet; +use rustc_index::bit_set::BitSet; use syntax_pos::DUMMY_SP; use crate::dataflow::{self, GenKillSet}; diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index ee33e9d47ab..6f860d00a22 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -5,7 +5,7 @@ use rustc::ty::TyCtxt; use rustc::mir::{self, Body, Location}; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use super::MoveDataParamEnv; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 09362e31795..06999abdc8b 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -2,7 +2,7 @@ use syntax::ast::{self, MetaItem}; use syntax::symbol::{Symbol, sym}; use rustc_index::bit_set::{BitSet, HybridBitSet}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_data_structures::work_queue::WorkQueue; use rustc::hir::def_id::DefId; diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index d9119253cae..53b18e4364b 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -1,7 +1,7 @@ use rustc::mir::tcx::RvalueInitializationState; use rustc::mir::*; use rustc::ty::{self, TyCtxt}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use smallvec::{smallvec, SmallVec}; use std::collections::hash_map::Entry; diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 156c19c6363..f5a03316d80 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -2,7 +2,7 @@ use core::slice::Iter; use rustc::mir::*; use rustc::ty::{Ty, TyCtxt}; use rustc::util::nodemap::FxHashMap; -use rustc_data_structures::indexed_vec::{Enumerated, Idx, IndexVec}; +use rustc_index::vec::{Enumerated, Idx, IndexVec}; use smallvec::SmallVec; use syntax_pos::Span; @@ -13,19 +13,19 @@ use self::abs_domain::{AbstractElem, Lift}; mod abs_domain; -newtype_index! { +rustc_index::newtype_index! { pub struct MovePathIndex { DEBUG_FORMAT = "mp{}" } } -newtype_index! { +rustc_index::newtype_index! { pub struct MoveOutIndex { DEBUG_FORMAT = "mo{}" } } -newtype_index! { +rustc_index::newtype_index! { pub struct InitIndex { DEBUG_FORMAT = "in{}" } diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 33d67dcf914..e9777dab26e 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -5,7 +5,7 @@ use rustc::middle::region; use rustc::hir; use rustc::ty; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { type Output = Block<'tcx>; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index eed51cdab8c..db314cb5faf 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -3,7 +3,7 @@ use crate::hair::cx::Cx; use crate::hair::cx::block; use crate::hair::cx::to_ref::ToRef; use crate::hair::util::UserAnnotatedTyHelpers; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc::hir::def::{CtorOf, Res, DefKind, CtorKind}; use rustc::mir::interpret::{GlobalId, ErrorHandled, ConstValue}; use rustc::ty::{self, AdtKind, Ty}; diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 32efbd6f011..e120b496d3d 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -5,7 +5,7 @@ use crate::hair::*; use crate::hair::util::UserAnnotatedTyHelpers; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc::hir::def_id::DefId; use rustc::hir::Node; use rustc::middle::region; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 75a84f6ec64..d3bc61a4dde 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -161,7 +161,7 @@ use self::Usefulness::*; use self::WitnessPreference::*; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use super::{FieldPat, Pat, PatKind, PatRange}; use super::{PatternFoldable, PatternFolder, compare_const_vals}; diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 4d2fee3d160..3793f7c1075 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -24,7 +24,7 @@ use rustc::hir::def::{CtorOf, Res, DefKind, CtorKind}; use rustc::hir::pat_util::EnumerateAndAdjustIterator; use rustc::hir::ptr::P; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_data_structures::fx::FxHashSet; use std::cmp::Ordering; diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index fdf85260c3d..e1c45132103 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -12,7 +12,7 @@ use rustc::ty::layout::{ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::ty::query::TyCtxtAt; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc::mir::interpret::{ GlobalId, Scalar, Pointer, FrameInfo, AllocId, InterpResult, truncate, sign_extend, diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 4c7d0dcb697..7ce151e087a 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -17,7 +17,7 @@ use rustc::mir::interpret::{ use rustc::ty::{self, TyCtxt}; use rustc::ty::layout::{Align, Size}; use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use syntax::ast::Mutability; use syntax::source_map::Span; diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 4fae0976ffb..7303880602e 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -6,7 +6,7 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::query::Providers; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use rustc_target::spec::abi::Abi; use syntax_pos::{Span, sym}; diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 15ecc6c3792..bf3df1ae2fd 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -1,6 +1,6 @@ use rustc::ty::TyCtxt; use rustc::mir::*; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use crate::transform::{MirPass, MirSource}; #[derive(PartialEq)] diff --git a/src/librustc_mir/transform/check_consts/qualifs.rs b/src/librustc_mir/transform/check_consts/qualifs.rs index d9d0ce18555..0c6468309dc 100644 --- a/src/librustc_mir/transform/check_consts/qualifs.rs +++ b/src/librustc_mir/transform/check_consts/qualifs.rs @@ -3,7 +3,7 @@ use rustc::mir::*; use rustc::mir::interpret::ConstValue; use rustc::ty::{self, Ty}; -use rustc_data_structures::bit_set::BitSet; +use rustc_index::bit_set::BitSet; use syntax_pos::DUMMY_SP; use super::Item as ConstCx; diff --git a/src/librustc_mir/transform/check_consts/resolver.rs b/src/librustc_mir/transform/check_consts/resolver.rs index 2789693ecb6..f95b240195b 100644 --- a/src/librustc_mir/transform/check_consts/resolver.rs +++ b/src/librustc_mir/transform/check_consts/resolver.rs @@ -5,7 +5,7 @@ use rustc::mir::visit::Visitor; use rustc::mir::{self, BasicBlock, Local, Location}; -use rustc_data_structures::bit_set::BitSet; +use rustc_index::bit_set::BitSet; use std::cell::RefCell; use std::marker::PhantomData; diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 7e876dd1d99..e74b22b4352 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -5,7 +5,7 @@ use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext, NonMutatingUs use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::{self, TyCtxt}; -use rustc_data_structures::bit_set::BitSet; +use rustc_index::bit_set::BitSet; use rustc_target::spec::abi::Abi; use syntax::symbol::sym; use syntax_pos::Span; diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index acd53ac68ae..70855d70228 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -1,5 +1,5 @@ use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::sync::Lrc; use rustc::ty::query::Providers; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 612822b6d9d..f34bfbeab3b 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -21,7 +21,7 @@ use syntax::ast::Mutability; use syntax_pos::{Span, DUMMY_SP}; use rustc::ty::subst::InternalSubsts; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc::ty::layout::{ LayoutOf, TyLayout, LayoutError, HasTyCtxt, TargetDataLayout, HasDataLayout, }; diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 649665b4aba..bfc5eb5a94e 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -58,7 +58,7 @@ use rustc::ty::GeneratorSubsts; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_index::bit_set::{BitSet, BitMatrix}; use std::borrow::Cow; use std::iter; diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index f4c522245f7..9830ed35ffc 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -4,7 +4,7 @@ use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::DefId; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc::mir::*; use rustc::mir::visit::*; diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 6b609e25ec0..bb98d63b1ee 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -5,7 +5,7 @@ use rustc::mir::{Constant, Location, Place, PlaceBase, Body, Operand, Projection use rustc::mir::visit::{MutVisitor, Visitor}; use rustc::ty::{self, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::mem; use crate::transform::{MirPass, MirSource}; diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 5037c791cb6..7e06729c2c7 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -1,5 +1,5 @@ use crate::{build, shim}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::mir::{Body, MirPhase, Promoted}; use rustc::ty::{TyCtxt, InstanceDef}; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 7d1b96b8be1..5d241ffe1c0 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -20,7 +20,7 @@ use rustc::ty::subst::InternalSubsts; use rustc::ty::TyCtxt; use syntax_pos::Span; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use std::{iter, mem, usize}; diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index ee7b0cada12..2fa6b9d1a29 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -5,7 +5,7 @@ //! diagnostics as to why a constant rvalue wasn't promoted. use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use rustc_data_structures::fx::FxHashSet; use rustc_target::spec::abi::Abi; use rustc::hir; diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index c6df9d49ec0..9ffff9a92fa 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -28,7 +28,7 @@ //! return. use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc::ty::TyCtxt; use rustc::mir::*; use rustc::mir::visit::{MutVisitor, Visitor, PlaceContext}; diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index eb61cd2f657..efa39d91205 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -30,7 +30,7 @@ use rustc::ty; use rustc::ty::TyCtxt; use rustc::mir::*; use rustc::mir::visit::{Visitor, PlaceContext, NonUseContext}; -use rustc_data_structures::indexed_vec::{IndexVec}; +use rustc_index::vec::{IndexVec}; use crate::transform::{MirPass, MirSource}; use crate::util::patch::MirPatch; diff --git a/src/librustc_mir/util/aggregate.rs b/src/librustc_mir/util/aggregate.rs index b3565d40b8e..c0f92185745 100644 --- a/src/librustc_mir/util/aggregate.rs +++ b/src/librustc_mir/util/aggregate.rs @@ -1,7 +1,7 @@ use rustc::mir::*; use rustc::ty::Ty; use rustc::ty::layout::VariantIdx; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::iter::TrustedLen; diff --git a/src/librustc_mir/util/def_use.rs b/src/librustc_mir/util/def_use.rs index 59821440c66..3aea25fa876 100644 --- a/src/librustc_mir/util/def_use.rs +++ b/src/librustc_mir/util/def_use.rs @@ -2,7 +2,7 @@ use rustc::mir::{Local, Location, Body}; use rustc::mir::visit::{PlaceContext, MutVisitor, Visitor}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_index::vec::IndexVec; use std::mem; pub struct DefUseAnalysis { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index e1015edfa8e..37b9398f9cb 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -7,7 +7,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc::ty::util::IntTypeExt; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use crate::util::patch::MirPatch; use std::convert::TryInto; diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index 9d142d9b700..7fcb7a40a3c 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -1,7 +1,7 @@ use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::TyCtxt; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::fmt::Debug; use std::io::{self, Write}; diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 24ee803c9f8..9757f4ac392 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -31,7 +31,7 @@ use rustc::mir::Local; use rustc::mir::*; use rustc::ty::{self, TyCtxt}; use rustc_index::bit_set::BitSet; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use rustc_data_structures::work_queue::WorkQueue; use std::fs; use std::io::{self, Write}; diff --git a/src/librustc_mir/util/patch.rs b/src/librustc_mir/util/patch.rs index 2ea9924af7f..a5f7e540157 100644 --- a/src/librustc_mir/util/patch.rs +++ b/src/librustc_mir/util/patch.rs @@ -1,6 +1,6 @@ use rustc::ty::Ty; use rustc::mir::*; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use syntax_pos::Span; /// This struct represents a patch to MIR, which can add diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index c35c9e4da9f..7f6b60b1b11 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -3,7 +3,7 @@ use rustc::mir::*; use rustc::mir::visit::Visitor; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use std::fmt::Display; use std::fmt::Write as _; use std::fs; diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index cab1e0e0137..fba2ea02bb4 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -14,3 +14,4 @@ log = "0.4" rustc_data_structures = { path = "../librustc_data_structures" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax_pos = { path = "../libsyntax_pos" } +rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index dafa8661176..26d37f196be 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -6,8 +6,7 @@ use crate::spec::Target; use std::fmt; use std::ops::{Add, Deref, Sub, Mul, AddAssign, Range, RangeInclusive}; -use rustc_data_structures::newtype_index; -use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use rustc_index::vec::{Idx, IndexVec}; use syntax_pos::symbol::{sym, Symbol}; use syntax_pos::Span; @@ -844,7 +843,7 @@ impl Abi { } } -newtype_index! { +rustc_index::newtype_index! { pub struct VariantIdx { .. } } diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index ac396667683..a6644258be2 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -20,3 +20,4 @@ rustc_target = { path = "../librustc_target" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } +rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a7832b8c2cf..131a33a4512 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -99,7 +99,7 @@ use crate::middle::lang_items; use crate::namespace::Namespace; use rustc::infer::{self, InferCtxt, InferOk, InferResult}; use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse}; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; use rustc_target::spec::abi::Abi; use rustc::infer::opaque_types::OpaqueTypeDecl; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index b530851b80d..8f35ca01f79 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -9,7 +9,7 @@ mod simplify; mod auto_trait; mod blanket_impl; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_index::vec::{IndexVec, Idx}; use rustc_target::spec::abi::Abi; use rustc_typeck::hir_ty_to_ty; use rustc::infer::region_constraints::{RegionConstraintData, Constraint}; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 2985e7f70b5..539bf5dfe28 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -25,6 +25,7 @@ extern crate getopts; extern crate env_logger; extern crate rustc; extern crate rustc_data_structures; +extern crate rustc_index; extern crate rustc_driver; extern crate rustc_resolve; extern crate rustc_lint; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index bc468c1ad0e..7a5c92167bc 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -14,7 +14,7 @@ use crate::symbol::{kw, sym, Symbol}; use crate::tokenstream::TokenStream; use crate::ThinVec; -use rustc_data_structures::indexed_vec::Idx; +use rustc_index::vec::Idx; #[cfg(target_arch = "x86_64")] use rustc_data_structures::static_assert_size; use rustc_target::spec::abi::Abi; @@ -241,9 +241,8 @@ impl ParenthesizedArgs { // hack to ensure that we don't try to access the private parts of `NodeId` in this module mod node_id_inner { - use rustc_data_structures::indexed_vec::Idx; - use rustc_data_structures::newtype_index; - newtype_index! { + use rustc_index::vec::Idx; + rustc_index::newtype_index! { pub struct NodeId { ENCODABLE = custom DEBUG_FORMAT = "NodeId({})" diff --git a/src/libsyntax_pos/Cargo.toml b/src/libsyntax_pos/Cargo.toml index bc13d2a1611..378f7a955a3 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -13,6 +13,7 @@ doctest = false rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_macros = { path = "../librustc_macros" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_index = { path = "../librustc_index" } arena = { path = "../libarena" } scoped-tls = "1.0" unicode-width = "0.1.4" diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 44a34070dec..1769135e7f2 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -4,8 +4,7 @@ use arena::DroplessArena; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; -use rustc_data_structures::newtype_index; +use rustc_index::vec::Idx; use rustc_macros::symbols; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_serialize::{UseSpecializedDecodable, UseSpecializedEncodable}; @@ -897,15 +896,15 @@ impl UseSpecializedDecodable for Ident { /// ``` /// Internally, a symbol is implemented as an index, and all operations /// (including hashing, equality, and ordering) operate on that index. The use -/// of `newtype_index!` means that `Option` only takes up 4 bytes, -/// because `newtype_index!` reserves the last 256 values for tagging purposes. +/// of `rustc_index::newtype_index!` means that `Option` only takes up 4 bytes, +/// because `rustc_index::newtype_index!` reserves the last 256 values for tagging purposes. /// -/// Note that `Symbol` cannot directly be a `newtype_index!` because it +/// Note that `Symbol` cannot directly be a `rustc_index::newtype_index!` because it /// implements `fmt::Debug`, `Encodable`, and `Decodable` in special ways. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Symbol(SymbolIndex); -newtype_index! { +rustc_index::newtype_index! { pub struct SymbolIndex { .. } } diff --git a/src/test/ui-fulldeps/newtype_index.rs b/src/test/ui-fulldeps/newtype_index.rs index 336b584768f..fe68b394e5a 100644 --- a/src/test/ui-fulldeps/newtype_index.rs +++ b/src/test/ui-fulldeps/newtype_index.rs @@ -2,10 +2,10 @@ #![feature(rustc_private)] -extern crate rustc_data_structures; +extern crate rustc_index; extern crate serialize as rustc_serialize; -use rustc_data_structures::{newtype_index, indexed_vec::Idx}; +use rustc_index::{newtype_index, vec::Idx}; newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });