Skip to content

Commit 9172899

Browse files
committed
normalize some imports, prefer direct ones.
1 parent 342c5f3 commit 9172899

File tree

29 files changed

+45
-50
lines changed

29 files changed

+45
-50
lines changed

src/librustc/dep_graph/dep_node.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
//! user of the `DepNode` API of having to know how to compute the expected
5050
//! fingerprint for a given set of node parameters.
5151
52-
use crate::hir::map::DefPathHash;
53-
use crate::ich::Fingerprint;
5452
use crate::mir;
5553
use crate::mir::interpret::{GlobalId, LitToConstInput};
5654
use crate::traits;
@@ -62,7 +60,9 @@ use crate::traits::query::{
6260
use crate::ty::subst::SubstsRef;
6361
use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt};
6462

63+
use rustc_data_structures::fingerprint::Fingerprint;
6564
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
65+
use rustc_hir::definitions::DefPathHash;
6666
use rustc_hir::HirId;
6767
use rustc_span::symbol::Symbol;
6868
use std::hash::Hash;

src/librustc/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::arena::Arena;
2-
use crate::hir::map::definitions::{self, DefPathHash};
32
use crate::hir::map::{Entry, HirOwnerData, Map};
43
use crate::hir::{Owner, OwnerNodes, ParentedNode};
54
use crate::ich::StableHashingContext;
@@ -11,6 +10,7 @@ use rustc_data_structures::svh::Svh;
1110
use rustc_hir as hir;
1211
use rustc_hir::def_id::CRATE_DEF_INDEX;
1312
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
13+
use rustc_hir::definitions::{self, DefPathHash};
1414
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
1515
use rustc_hir::*;
1616
use rustc_index::vec::{Idx, IndexVec};

src/librustc/hir/map/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ use rustc_ast::ast::{self, Name, NodeId};
77
use rustc_data_structures::svh::Svh;
88
use rustc_hir::def::{DefKind, Res};
99
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
10-
pub use rustc_hir::definitions;
11-
pub use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash};
12-
pub use rustc_hir::definitions::{Definitions, DisambiguatedDefPathData};
10+
use rustc_hir::definitions::{DefKey, DefPath, Definitions};
1311
use rustc_hir::intravisit;
1412
use rustc_hir::itemlikevisit::ItemLikeVisitor;
1513
use rustc_hir::print::Nested;

src/librustc/ich/hcx.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::hir::map::definitions::{DefPathHash, Definitions};
2-
use crate::ich::{self, CachingSourceMapView};
1+
use crate::ich;
32
use crate::middle::cstore::CrateStore;
43
use crate::ty::{fast_reject, TyCtxt};
54

@@ -9,10 +8,11 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
98
use rustc_data_structures::sync::Lrc;
109
use rustc_hir as hir;
1110
use rustc_hir::def_id::{DefId, LocalDefId};
11+
use rustc_hir::definitions::{DefPathHash, Definitions};
1212
use rustc_session::Session;
1313
use rustc_span::source_map::SourceMap;
1414
use rustc_span::symbol::Symbol;
15-
use rustc_span::{BytePos, SourceFile};
15+
use rustc_span::{BytePos, CachingSourceMapView, SourceFile};
1616

1717
use smallvec::SmallVec;
1818
use std::cmp::Ord;

src/librustc/ich/impls_hir.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//! This module contains `HashStable` implementations for various HIR data
22
//! types in no particular order.
33
4-
use crate::hir::map::DefPathHash;
5-
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
4+
use crate::ich::{NodeIdHashingMode, StableHashingContext};
65
use rustc_attr as attr;
6+
use rustc_data_structures::fingerprint::Fingerprint;
77
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
88
use rustc_hir as hir;
99
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
10+
use rustc_hir::definitions::DefPathHash;
1011
use smallvec::SmallVec;
1112
use std::mem;
1213

src/librustc/ich/impls_ty.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! This module contains `HashStable` implementations for various data types
22
//! from rustc::ty in no particular order.
33
4-
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
4+
use crate::ich::{NodeIdHashingMode, StableHashingContext};
55
use crate::middle::region;
66
use crate::mir;
77
use crate::ty;
8+
use rustc_data_structures::fingerprint::Fingerprint;
89
use rustc_data_structures::fx::FxHashMap;
910
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
1011
use std::cell::RefCell;

src/librustc/ich/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
pub use self::hcx::{
44
hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider,
55
};
6-
crate use rustc_data_structures::fingerprint::Fingerprint;
76
use rustc_span::symbol::{sym, Symbol};
87
pub use rustc_span::CachingSourceMapView;
98

src/librustc/middle/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
55
pub use self::NativeLibraryKind::*;
66

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

109
use rustc_ast::ast;
1110
use rustc_ast::expand::allocator::AllocatorKind;
1211
use rustc_data_structures::svh::Svh;
1312
use rustc_data_structures::sync::{self, MetadataRef};
1413
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
14+
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, DefPathTable};
1515
use rustc_macros::HashStable;
1616
use rustc_session::search_paths::PathKind;
1717
pub use rustc_session::utils::NativeLibraryKind;

src/librustc/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use super::{AllocId, CheckInAllocMsg, Pointer, RawConst, ScalarMaybeUndef};
22

3-
use crate::hir::map::definitions::DefPathData;
43
use crate::mir::interpret::ConstValue;
54
use crate::ty::layout::{Align, LayoutError, Size};
65
use crate::ty::query::TyCtxtAt;
@@ -11,6 +10,7 @@ use backtrace::Backtrace;
1110
use rustc_data_structures::sync::Lock;
1211
use rustc_errors::{struct_span_err, DiagnosticBuilder};
1312
use rustc_hir as hir;
13+
use rustc_hir::definitions::DefPathData;
1414
use rustc_macros::HashStable;
1515
use rustc_session::CtfeBacktrace;
1616
use rustc_span::{def_id::DefId, Pos, Span};

src/librustc/mir/mono.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
2-
use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext};
2+
use crate::ich::{NodeIdHashingMode, StableHashingContext};
33
use crate::ty::print::obsolete::DefPathBasedNames;
44
use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt};
55
use rustc_attr::InlineAttr;
66
use rustc_data_structures::base_n;
7+
use rustc_data_structures::fingerprint::Fingerprint;
78
use rustc_data_structures::fx::FxHashMap;
89
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
910
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};

src/librustc/ty/context.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ use crate::arena::Arena;
44
use crate::dep_graph::DepGraph;
55
use crate::dep_graph::{self, DepConstructor};
66
use crate::hir::exports::Export;
7-
use crate::hir::map as hir_map;
8-
use crate::hir::map::definitions::Definitions;
9-
use crate::hir::map::{DefPathData, DefPathHash};
107
use crate::ich::{NodeIdHashingMode, StableHashingContext};
118
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
129
use crate::lint::{struct_lint_level, LintSource};
@@ -56,6 +53,7 @@ use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
5653
use rustc_hir as hir;
5754
use rustc_hir::def::{DefKind, Res};
5855
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LOCAL_CRATE};
56+
use rustc_hir::definitions::{DefPathData, DefPathHash, Definitions};
5957
use rustc_hir::{HirId, Node, TraitCandidate};
6058
use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet};
6159
use rustc_index::vec::{Idx, IndexVec};
@@ -1235,7 +1233,7 @@ impl<'tcx> TyCtxt<'tcx> {
12351233
self.features_query(LOCAL_CRATE)
12361234
}
12371235

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

@@ -1244,7 +1242,7 @@ impl<'tcx> TyCtxt<'tcx> {
12441242
///
12451243
/// Note that if `id` is not local to this crate, the result will
12461244
/// be a non-local `DefPath`.
1247-
pub fn def_path(self, id: DefId) -> hir_map::DefPath {
1245+
pub fn def_path(self, id: DefId) -> rustc_hir::definitions::DefPath {
12481246
if let Some(id) = id.as_local() {
12491247
self.hir().def_path(id)
12501248
} else {
@@ -1259,7 +1257,7 @@ impl<'tcx> TyCtxt<'tcx> {
12591257
}
12601258

12611259
#[inline]
1262-
pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash {
1260+
pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash {
12631261
if let Some(def_id) = def_id.as_local() {
12641262
self.definitions.def_path_hash(def_id)
12651263
} else {

src/librustc/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'tcx> InstanceDef<'tcx> {
166166
/// Note that this is only a hint. See the documentation for
167167
/// `generates_cgu_internal_copy` for more information.
168168
pub fn requires_inline(&self, tcx: TyCtxt<'tcx>) -> bool {
169-
use crate::hir::map::DefPathData;
169+
use rustc_hir::definitions::DefPathData;
170170
let def_id = match *self {
171171
ty::InstanceDef::Item(def_id) => def_id,
172172
ty::InstanceDef::DropGlue(_, Some(_)) => return false,

src/librustc/ty/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ pub use self::Variance::*;
88

99
use crate::arena::Arena;
1010
use crate::hir::exports::ExportMap;
11-
use crate::hir::map as hir_map;
12-
use crate::ich::Fingerprint;
1311
use crate::ich::StableHashingContext;
1412
use crate::infer::canonical::Canonical;
1513
use crate::middle::cstore::CrateStoreDyn;
@@ -28,6 +26,7 @@ use rustc_ast::ast::{self, Ident, Name};
2826
use rustc_ast::node_id::{NodeId, NodeMap, NodeSet};
2927
use rustc_attr as attr;
3028
use rustc_data_structures::captures::Captures;
29+
use rustc_data_structures::fingerprint::Fingerprint;
3130
use rustc_data_structures::fx::FxHashMap;
3231
use rustc_data_structures::fx::FxIndexMap;
3332
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
@@ -124,7 +123,7 @@ mod sty;
124123
// Data types
125124

126125
pub struct ResolverOutputs {
127-
pub definitions: hir_map::Definitions,
126+
pub definitions: rustc_hir::definitions::Definitions,
128127
pub cstore: Box<CrateStoreDyn>,
129128
pub extern_crate_map: NodeMap<CrateNum>,
130129
pub trait_map: TraitMap<NodeId>,
@@ -2986,7 +2985,7 @@ impl<'tcx> TyCtxt<'tcx> {
29862985
let def_key = self.def_key(id);
29872986
match def_key.disambiguated_data.data {
29882987
// The name of a constructor is that of its parent.
2989-
hir_map::DefPathData::Ctor => {
2988+
rustc_hir::definitions::DefPathData::Ctor => {
29902989
self.item_name(DefId { krate: id.krate, index: def_key.parent.unwrap() })
29912990
}
29922991
_ => def_key.disambiguated_data.data.get_opt_name().unwrap_or_else(|| {

src/librustc/ty/print/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
21
use crate::ty::subst::{GenericArg, Subst};
32
use crate::ty::{self, DefIdTree, Ty, TyCtxt};
43

54
use rustc_data_structures::fx::FxHashSet;
65
use rustc_hir::def_id::{CrateNum, DefId};
6+
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
77

88
// `pretty` is a separate module only for organization.
99
mod pretty;

src/librustc/ty/print/pretty.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
use crate::hir::map::{DefPathData, DisambiguatedDefPathData};
21
use crate::middle::cstore::{ExternCrate, ExternCrateSource};
32
use crate::middle::region;
43
use crate::mir::interpret::{sign_extend, truncate, AllocId, ConstValue, Pointer, Scalar};
54
use crate::ty::layout::{Integer, IntegerExt, Size};
65
use crate::ty::subst::{GenericArg, GenericArgKind, Subst};
76
use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable};
8-
use rustc_hir as hir;
9-
use rustc_hir::def::{DefKind, Namespace};
10-
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
11-
127
use rustc_apfloat::ieee::{Double, Single};
138
use rustc_apfloat::Float;
149
use rustc_ast::ast;
1510
use rustc_attr::{SignedInt, UnsignedInt};
11+
use rustc_hir as hir;
12+
use rustc_hir::def::{DefKind, Namespace};
13+
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
14+
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
1615
use rustc_span::symbol::{kw, Symbol};
1716
use rustc_target::spec::abi::Abi;
1817

src/librustc/ty/query/on_disk_cache.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
2-
use crate::hir::map::definitions::DefPathHash;
3-
use crate::ich::{CachingSourceMapView, Fingerprint};
42
use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState};
53
use crate::mir::{self, interpret};
64
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
75
use crate::ty::context::TyCtxt;
86
use crate::ty::{self, Ty};
97
use rustc_ast::ast::Ident;
8+
use rustc_data_structures::fingerprint::Fingerprint;
109
use rustc_data_structures::fx::FxHashMap;
1110
use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once};
1211
use rustc_data_structures::thin_vec::ThinVec;
1312
use rustc_errors::Diagnostic;
1413
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
14+
use rustc_hir::definitions::DefPathHash;
1515
use rustc_index::vec::{Idx, IndexVec};
1616
use rustc_serialize::{
1717
opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder,
@@ -20,6 +20,7 @@ use rustc_serialize::{
2020
use rustc_session::{CrateDisambiguator, Session};
2121
use rustc_span::hygiene::{ExpnId, SyntaxContext};
2222
use rustc_span::source_map::{SourceMap, StableSourceFileId};
23+
use rustc_span::CachingSourceMapView;
2324
use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP};
2425
use std::mem;
2526

src/librustc/ty/query/plumbing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ impl<'tcx> TyCtxt<'tcx> {
667667
dep_node: &DepNode,
668668
dep_node_index: DepNodeIndex,
669669
) {
670-
use crate::ich::Fingerprint;
670+
use rustc_data_structures::fingerprint::Fingerprint;
671671

672672
assert!(
673673
Some(self.dep_graph.fingerprint_of(dep_node_index))

src/librustc/ty/query/profiling_support.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::hir::map::definitions::DefPathData;
21
use crate::ty::context::TyCtxt;
32
use crate::ty::query::caches::QueryCache;
43
use crate::ty::query::plumbing::QueryState;
54
use measureme::{StringComponent, StringId};
65
use rustc_data_structures::fx::FxHashMap;
76
use rustc_data_structures::profiling::SelfProfiler;
87
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE};
8+
use rustc_hir::definitions::DefPathData;
99
use std::fmt::Debug;
1010
use std::io::Write;
1111

src/librustc/ty/trait_def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::hir::map::DefPathHash;
21
use crate::ich::{self, StableHashingContext};
32
use crate::traits::specialization_graph;
43
use crate::ty::fast_reject;
54
use crate::ty::fold::TypeFoldable;
65
use crate::ty::{Ty, TyCtxt};
76
use rustc_hir as hir;
87
use rustc_hir::def_id::{CrateNum, DefId};
8+
use rustc_hir::definitions::DefPathHash;
99
use rustc_hir::HirId;
1010

1111
use rustc_data_structures::fx::FxHashMap;

src/librustc/ty/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Miscellaneous type-system utilities that are too small to deserve their own modules.
22
3-
use crate::hir::map::DefPathData;
43
use crate::ich::NodeIdHashingMode;
54
use crate::mir::interpret::{sign_extend, truncate};
65
use crate::ty::layout::{Integer, IntegerExt, Size};
@@ -17,6 +16,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1716
use rustc_hir as hir;
1817
use rustc_hir::def::DefKind;
1918
use rustc_hir::def_id::DefId;
19+
use rustc_hir::definitions::DefPathData;
2020
use rustc_macros::HashStable;
2121
use rustc_span::Span;
2222
use rustc_target::abi::TargetDataLayout;

src/librustc_codegen_llvm/debuginfo/namespace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc::ty::{self, Instance};
66
use crate::common::CodegenCx;
77
use crate::llvm;
88
use crate::llvm::debuginfo::DIScope;
9-
use rustc::hir::map::DefPathData;
109
use rustc_hir::def_id::DefId;
10+
use rustc_hir::definitions::DefPathData;
1111

1212
pub fn mangled_name_of_instance<'a, 'tcx>(
1313
cx: &CodegenCx<'a, 'tcx>,

src/librustc_infer/infer/error_reporting/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ use crate::traits::{
5555
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
5656
};
5757

58-
use rustc::hir::map;
5958
use rustc::middle::region;
6059
use rustc::ty::error::TypeError;
6160
use rustc::ty::{
@@ -549,7 +548,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
549548
terr: &TypeError<'tcx>,
550549
) {
551550
use hir::def_id::CrateNum;
552-
use map::DisambiguatedDefPathData;
551+
use rustc_hir::definitions::DisambiguatedDefPathData;
553552
use ty::print::Printer;
554553
use ty::subst::GenericArg;
555554

src/librustc_interface/passes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::util;
55
use log::{info, log_enabled, warn};
66
use rustc::arena::Arena;
77
use rustc::dep_graph::DepGraph;
8-
use rustc::hir::map::Definitions;
98
use rustc::middle;
109
use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn};
1110
use rustc::ty::steal::Steal;
@@ -20,6 +19,7 @@ use rustc_data_structures::{box_region_allow_access, declare_box_region_type, pa
2019
use rustc_errors::PResult;
2120
use rustc_expand::base::ExtCtxt;
2221
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
22+
use rustc_hir::definitions::Definitions;
2323
use rustc_hir::Crate;
2424
use rustc_lint::LintStore;
2525
use rustc_mir as mir;

0 commit comments

Comments
 (0)