Skip to content

Commit

Permalink
Rollup merge of rust-lang#70373 - Centril:canon-imports, r=Mark-Simul…
Browse files Browse the repository at this point in the history
…acrum

normalize some imports & prefer direct ones

r? @Mark-Simulacrum
  • Loading branch information
Centril authored Mar 25, 2020
2 parents 1059604 + 9172899 commit f54005a
Show file tree
Hide file tree
Showing 29 changed files with 45 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
//! user of the `DepNode` API of having to know how to compute the expected
//! fingerprint for a given set of node parameters.
use crate::hir::map::DefPathHash;
use crate::ich::Fingerprint;
use crate::mir;
use crate::mir::interpret::{GlobalId, LitToConstInput};
use crate::traits;
Expand All @@ -62,7 +60,9 @@ use crate::traits::query::{
use crate::ty::subst::SubstsRef;
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};

use rustc_data_structures::fingerprint::Fingerprint;
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
use rustc_hir::definitions::DefPathHash;
use rustc_hir::HirId;
use rustc_span::symbol::Symbol;
use std::hash::Hash;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::arena::Arena;
use crate::hir::map::definitions::{self, DefPathHash};
use crate::hir::map::{Entry, HirOwnerData, Map};
use crate::hir::{Owner, OwnerNodes, ParentedNode};
use crate::ich::StableHashingContext;
Expand All @@ -11,6 +10,7 @@ use rustc_data_structures::svh::Svh;
use rustc_hir as hir;
use rustc_hir::def_id::CRATE_DEF_INDEX;
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
use rustc_hir::definitions::{self, DefPathHash};
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::*;
use rustc_index::vec::{Idx, IndexVec};
Expand Down
4 changes: 1 addition & 3 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use rustc_ast::ast::{self, Name, NodeId};
use rustc_data_structures::svh::Svh;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
pub use rustc_hir::definitions;
pub use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash};
pub use rustc_hir::definitions::{Definitions, DisambiguatedDefPathData};
use rustc_hir::definitions::{DefKey, DefPath, Definitions};
use rustc_hir::intravisit;
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::print::Nested;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::hir::map::definitions::{DefPathHash, Definitions};
use crate::ich::{self, CachingSourceMapView};
use crate::ich;
use crate::middle::cstore::CrateStore;
use crate::ty::{fast_reject, TyCtxt};

Expand All @@ -9,10 +8,11 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::definitions::{DefPathHash, Definitions};
use rustc_session::Session;
use rustc_span::source_map::SourceMap;
use rustc_span::symbol::Symbol;
use rustc_span::{BytePos, SourceFile};
use rustc_span::{BytePos, CachingSourceMapView, SourceFile};

use smallvec::SmallVec;
use std::cmp::Ord;
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! This module contains `HashStable` implementations for various HIR data
//! types in no particular order.
use crate::hir::map::DefPathHash;
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use rustc_attr as attr;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use rustc_hir as hir;
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
use rustc_hir::definitions::DefPathHash;
use smallvec::SmallVec;
use std::mem;

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! This module contains `HashStable` implementations for various data types
//! from rustc::ty in no particular order.
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::middle::region;
use crate::mir;
use crate::ty;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use std::cell::RefCell;
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ich/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
pub use self::hcx::{
hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider,
};
crate use rustc_data_structures::fingerprint::Fingerprint;
use rustc_span::symbol::{sym, Symbol};
pub use rustc_span::CachingSourceMapView;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
pub use self::NativeLibraryKind::*;

use crate::hir::map::definitions::{DefKey, DefPath, DefPathHash, DefPathTable};
use crate::ty::TyCtxt;

use rustc_ast::ast;
use rustc_ast::expand::allocator::AllocatorKind;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{self, MetadataRef};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, DefPathTable};
use rustc_macros::HashStable;
use rustc_session::search_paths::PathKind;
pub use rustc_session::utils::NativeLibraryKind;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::{AllocId, CheckInAllocMsg, Pointer, RawConst, ScalarMaybeUndef};

use crate::hir::map::definitions::DefPathData;
use crate::mir::interpret::ConstValue;
use crate::ty::layout::{Align, LayoutError, Size};
use crate::ty::query::TyCtxtAt;
Expand All @@ -11,6 +10,7 @@ use backtrace::Backtrace;
use rustc_data_structures::sync::Lock;
use rustc_errors::{struct_span_err, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::definitions::DefPathData;
use rustc_macros::HashStable;
use rustc_session::CtfeBacktrace;
use rustc_span::{def_id::DefId, Pos, Span};
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/mir/mono.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::ty::print::obsolete::DefPathBasedNames;
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
use rustc_attr::InlineAttr;
use rustc_data_structures::base_n;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
Expand Down
10 changes: 4 additions & 6 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ use crate::arena::Arena;
use crate::dep_graph::DepGraph;
use crate::dep_graph::{self, DepConstructor};
use crate::hir::exports::Export;
use crate::hir::map as hir_map;
use crate::hir::map::definitions::Definitions;
use crate::hir::map::{DefPathData, DefPathHash};
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintSource};
Expand Down Expand Up @@ -56,6 +53,7 @@ use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LOCAL_CRATE};
use rustc_hir::definitions::{DefPathData, DefPathHash, Definitions};
use rustc_hir::{HirId, Node, TraitCandidate};
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
use rustc_index::vec::{Idx, IndexVec};
Expand Down Expand Up @@ -1236,7 +1234,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.features_query(LOCAL_CRATE)
}

pub fn def_key(self, id: DefId) -> hir_map::DefKey {
pub fn def_key(self, id: DefId) -> rustc_hir::definitions::DefKey {
if let Some(id) = id.as_local() { self.hir().def_key(id) } else { self.cstore.def_key(id) }
}

Expand All @@ -1245,7 +1243,7 @@ impl<'tcx> TyCtxt<'tcx> {
///
/// Note that if `id` is not local to this crate, the result will
/// be a non-local `DefPath`.
pub fn def_path(self, id: DefId) -> hir_map::DefPath {
pub fn def_path(self, id: DefId) -> rustc_hir::definitions::DefPath {
if let Some(id) = id.as_local() {
self.hir().def_path(id)
} else {
Expand All @@ -1260,7 +1258,7 @@ impl<'tcx> TyCtxt<'tcx> {
}

#[inline]
pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash {
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
if let Some(def_id) = def_id.as_local() {
self.definitions.def_path_hash(def_id)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<'tcx> InstanceDef<'tcx> {
/// Note that this is only a hint. See the documentation for
/// `generates_cgu_internal_copy` for more information.
pub fn requires_inline(&self, tcx: TyCtxt<'tcx>) -> bool {
use crate::hir::map::DefPathData;
use rustc_hir::definitions::DefPathData;
let def_id = match *self {
ty::InstanceDef::Item(def_id) => def_id,
ty::InstanceDef::DropGlue(_, Some(_)) => return false,
Expand Down
7 changes: 3 additions & 4 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub use self::Variance::*;

use crate::arena::Arena;
use crate::hir::exports::ExportMap;
use crate::hir::map as hir_map;
use crate::ich::Fingerprint;
use crate::ich::StableHashingContext;
use crate::infer::canonical::Canonical;
use crate::middle::cstore::CrateStoreDyn;
Expand All @@ -28,6 +26,7 @@ use rustc_ast::ast::{self, Ident, Name};
use rustc_ast::node_id::{NodeId, NodeMap, NodeSet};
use rustc_attr as attr;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
Expand Down Expand Up @@ -124,7 +123,7 @@ mod sty;
// Data types

pub struct ResolverOutputs {
pub definitions: hir_map::Definitions,
pub definitions: rustc_hir::definitions::Definitions,
pub cstore: Box<CrateStoreDyn>,
pub extern_crate_map: NodeMap<CrateNum>,
pub trait_map: TraitMap<NodeId>,
Expand Down Expand Up @@ -2986,7 +2985,7 @@ impl<'tcx> TyCtxt<'tcx> {
let def_key = self.def_key(id);
match def_key.disambiguated_data.data {
// The name of a constructor is that of its parent.
hir_map::DefPathData::Ctor => {
rustc_hir::definitions::DefPathData::Ctor => {
self.item_name(DefId { krate: id.krate, index: def_key.parent.unwrap() })
}
_ => def_key.disambiguated_data.data.get_opt_name().unwrap_or_else(|| {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/print/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
use crate::ty::subst::{GenericArg, Subst};
use crate::ty::{self, DefIdTree, Ty, TyCtxt};

use rustc_data_structures::fx::FxHashSet;
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};

// `pretty` is a separate module only for organization.
mod pretty;
Expand Down
9 changes: 4 additions & 5 deletions src/librustc/ty/print/pretty.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
use crate::middle::cstore::{ExternCrate, ExternCrateSource};
use crate::middle::region;
use crate::mir::interpret::{sign_extend, truncate, AllocId, ConstValue, Pointer, Scalar};
use crate::ty::layout::{Integer, IntegerExt, Size};
use crate::ty::subst::{GenericArg, GenericArgKind, Subst};
use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Namespace};
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};

use rustc_apfloat::ieee::{Double, Single};
use rustc_apfloat::Float;
use rustc_ast::ast;
use rustc_attr::{SignedInt, UnsignedInt};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Namespace};
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
use rustc_span::symbol::{kw, Symbol};
use rustc_target::spec::abi::Abi;

Expand Down
5 changes: 3 additions & 2 deletions src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
use crate::hir::map::definitions::DefPathHash;
use crate::ich::{CachingSourceMapView, Fingerprint};
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
use crate::mir::{self, interpret};
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
use crate::ty::context::TyCtxt;
use crate::ty::{self, Ty};
use rustc_ast::ast::Ident;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once};
use rustc_data_structures::thin_vec::ThinVec;
use rustc_errors::Diagnostic;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
use rustc_hir::definitions::DefPathHash;
use rustc_index::vec::{Idx, IndexVec};
use rustc_serialize::{
opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder,
Expand All @@ -20,6 +20,7 @@ use rustc_serialize::{
use rustc_session::{CrateDisambiguator, Session};
use rustc_span::hygiene::{ExpnId, SyntaxContext};
use rustc_span::source_map::{SourceMap, StableSourceFileId};
use rustc_span::CachingSourceMapView;
use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP};
use std::mem;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ impl<'tcx> TyCtxt<'tcx> {
dep_node: &DepNode,
dep_node_index: DepNodeIndex,
) {
use crate::ich::Fingerprint;
use rustc_data_structures::fingerprint::Fingerprint;

assert!(
Some(self.dep_graph.fingerprint_of(dep_node_index))
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/profiling_support.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::hir::map::definitions::DefPathData;
use crate::ty::context::TyCtxt;
use crate::ty::query::caches::QueryCache;
use crate::ty::query::plumbing::QueryState;
use measureme::{StringComponent, StringId};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::profiling::SelfProfiler;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::DefPathData;
use std::fmt::Debug;
use std::io::Write;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/trait_def.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::hir::map::DefPathHash;
use crate::ich::{self, StableHashingContext};
use crate::traits::specialization_graph;
use crate::ty::fast_reject;
use crate::ty::fold::TypeFoldable;
use crate::ty::{Ty, TyCtxt};
use rustc_hir as hir;
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_hir::definitions::DefPathHash;
use rustc_hir::HirId;

use rustc_data_structures::fx::FxHashMap;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Miscellaneous type-system utilities that are too small to deserve their own modules.
use crate::hir::map::DefPathData;
use crate::ich::NodeIdHashingMode;
use crate::mir::interpret::{sign_extend, truncate};
use crate::ty::layout::{Integer, IntegerExt, Size};
Expand All @@ -17,6 +16,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::definitions::DefPathData;
use rustc_macros::HashStable;
use rustc_span::Span;
use rustc_target::abi::TargetDataLayout;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use rustc::ty::{self, Instance};
use crate::common::CodegenCx;
use crate::llvm;
use crate::llvm::debuginfo::DIScope;
use rustc::hir::map::DefPathData;
use rustc_hir::def_id::DefId;
use rustc_hir::definitions::DefPathData;

pub fn mangled_name_of_instance<'a, 'tcx>(
cx: &CodegenCx<'a, 'tcx>,
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_infer/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ use crate::traits::{
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
};

use rustc::hir::map;
use rustc::middle::region;
use rustc::ty::error::TypeError;
use rustc::ty::{
Expand Down Expand Up @@ -549,7 +548,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
terr: &TypeError<'tcx>,
) {
use hir::def_id::CrateNum;
use map::DisambiguatedDefPathData;
use rustc_hir::definitions::DisambiguatedDefPathData;
use ty::print::Printer;
use ty::subst::GenericArg;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::util;
use log::{info, log_enabled, warn};
use rustc::arena::Arena;
use rustc::dep_graph::DepGraph;
use rustc::hir::map::Definitions;
use rustc::middle;
use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn};
use rustc::ty::steal::Steal;
Expand All @@ -20,6 +19,7 @@ use rustc_data_structures::{box_region_allow_access, declare_box_region_type, pa
use rustc_errors::PResult;
use rustc_expand::base::ExtCtxt;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_hir::definitions::Definitions;
use rustc_hir::Crate;
use rustc_lint::LintStore;
use rustc_mir as mir;
Expand Down
Loading

0 comments on commit f54005a

Please sign in to comment.