diff --git a/Cargo.lock b/Cargo.lock index a25f8dbc9186a..83b0bf308d48a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3368,6 +3368,7 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_errors", + "rustc_hir", "rustc_index", "rustc_session", "rustc_span", @@ -3411,6 +3412,7 @@ dependencies = [ "rustc_expand", "rustc_feature", "rustc_fs_util", + "rustc_hir", "rustc_incremental", "rustc_index", "rustc_llvm", @@ -3439,6 +3441,7 @@ dependencies = [ "rustc_error_codes", "rustc_errors", "rustc_fs_util", + "rustc_hir", "rustc_incremental", "rustc_index", "rustc_session", @@ -3458,6 +3461,7 @@ dependencies = [ "rustc", "rustc-demangle", "rustc_data_structures", + "rustc_hir", "rustc_metadata", "rustc_span", "rustc_target", @@ -3502,6 +3506,7 @@ dependencies = [ "rustc_error_codes", "rustc_errors", "rustc_feature", + "rustc_hir", "rustc_interface", "rustc_lint", "rustc_metadata", @@ -3590,6 +3595,7 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_fs_util", + "rustc_hir", "rustc_session", "rustc_span", "serialize", @@ -3656,6 +3662,7 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_feature", + "rustc_hir", "rustc_index", "rustc_session", "rustc_span", @@ -3707,6 +3714,7 @@ dependencies = [ "rustc_error_codes", "rustc_errors", "rustc_expand", + "rustc_hir", "rustc_index", "rustc_parse", "rustc_span", @@ -3733,6 +3741,7 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_errors", + "rustc_hir", "rustc_index", "rustc_lexer", "rustc_macros", @@ -3781,6 +3790,7 @@ dependencies = [ "rustc_error_codes", "rustc_errors", "rustc_feature", + "rustc_hir", "rustc_index", "rustc_parse", "rustc_span", @@ -3794,6 +3804,7 @@ version = "0.0.0" dependencies = [ "rustc", "rustc_error_codes", + "rustc_hir", "rustc_metadata", "rustc_span", "syntax", @@ -3807,6 +3818,7 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_error_codes", + "rustc_hir", "rustc_span", "rustc_typeck", "syntax", @@ -3826,6 +3838,7 @@ dependencies = [ "rustc_errors", "rustc_expand", "rustc_feature", + "rustc_hir", "rustc_metadata", "rustc_session", "rustc_span", @@ -3843,6 +3856,7 @@ dependencies = [ "rustc", "rustc_codegen_utils", "rustc_data_structures", + "rustc_hir", "rustc_parse", "rustc_span", "serde_json", @@ -3911,6 +3925,7 @@ dependencies = [ "log", "rustc", "rustc_data_structures", + "rustc_hir", "rustc_macros", "rustc_span", "rustc_target", @@ -3939,6 +3954,7 @@ dependencies = [ "rustc_data_structures", "rustc_error_codes", "rustc_errors", + "rustc_hir", "rustc_index", "rustc_span", "rustc_target", diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index 1c7d36b731225..cb3fdff53a3b0 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -38,13 +38,13 @@ macro_rules! arena_types { [] tables: rustc::ty::TypeckTables<$tcx>, [] const_allocs: rustc::mir::interpret::Allocation, [] vtable_method: Option<( - rustc::hir::def_id::DefId, + rustc_hir::def_id::DefId, rustc::ty::subst::SubstsRef<$tcx> )>, - [few, decode] mir_keys: rustc::hir::def_id::DefIdSet, + [few, decode] mir_keys: rustc_hir::def_id::DefIdSet, [decode] specialization_graph: rustc::traits::specialization_graph::Graph, [] region_scope_tree: rustc::middle::region::ScopeTree, - [] item_local_set: rustc::hir::ItemLocalSet, + [] item_local_set: rustc_hir::ItemLocalSet, [decode] mir_const_qualif: rustc_index::bit_set::BitSet, [] trait_impls_of: rustc::ty::trait_def::TraitImpls, [] dropck_outlives: @@ -87,75 +87,75 @@ macro_rules! arena_types { >, [few] crate_inherent_impls: rustc::ty::CrateInherentImpls, [few] upstream_monomorphizations: - rustc::hir::def_id::DefIdMap< + rustc_hir::def_id::DefIdMap< rustc_data_structures::fx::FxHashMap< rustc::ty::subst::SubstsRef<'tcx>, - rustc::hir::def_id::CrateNum + rustc_hir::def_id::CrateNum > >, [few] diagnostic_items: rustc_data_structures::fx::FxHashMap< rustc_span::symbol::Symbol, - rustc::hir::def_id::DefId, + rustc_hir::def_id::DefId, >, [few] resolve_lifetimes: rustc::middle::resolve_lifetime::ResolveLifetimes, [few] lint_levels: rustc::lint::LintLevelMap, [few] stability_index: rustc::middle::stability::Index<'tcx>, [few] features: rustc_feature::Features, - [few] all_traits: Vec, + [few] all_traits: Vec, [few] privacy_access_levels: rustc::middle::privacy::AccessLevels, [few] target_features_whitelist: rustc_data_structures::fx::FxHashMap< String, Option >, [few] wasm_import_module_map: rustc_data_structures::fx::FxHashMap< - rustc::hir::def_id::DefId, + rustc_hir::def_id::DefId, String >, [few] get_lib_features: rustc::middle::lib_features::LibFeatures, [few] defined_lib_features: rustc::middle::lang_items::LanguageItems, - [few] visible_parent_map: rustc::hir::def_id::DefIdMap, + [few] visible_parent_map: rustc_hir::def_id::DefIdMap, [few] foreign_module: rustc::middle::cstore::ForeignModule, [few] foreign_modules: Vec, - [few] reachable_non_generics: rustc::hir::def_id::DefIdMap< + [few] reachable_non_generics: rustc_hir::def_id::DefIdMap< rustc::middle::exported_symbols::SymbolExportLevel >, [few] crate_variances: rustc::ty::CrateVariancesMap<'tcx>, [few] inferred_outlives_crate: rustc::ty::CratePredicatesMap<'tcx>, - [] upvars: rustc_data_structures::fx::FxIndexMap, + [] upvars: rustc_data_structures::fx::FxIndexMap, // HIR types [few] hir_forest: rustc::hir::map::Forest<$tcx>, - [] arm: rustc::hir::Arm<$tcx>, + [] arm: rustc_hir::Arm<$tcx>, [] attribute: syntax::ast::Attribute, - [] block: rustc::hir::Block<$tcx>, - [] bare_fn_ty: rustc::hir::BareFnTy<$tcx>, - [few] global_asm: rustc::hir::GlobalAsm, - [] generic_arg: rustc::hir::GenericArg<$tcx>, - [] generic_args: rustc::hir::GenericArgs<$tcx>, - [] generic_bound: rustc::hir::GenericBound<$tcx>, - [] generic_param: rustc::hir::GenericParam<$tcx>, - [] expr: rustc::hir::Expr<$tcx>, - [] field: rustc::hir::Field<$tcx>, - [] field_pat: rustc::hir::FieldPat<$tcx>, - [] fn_decl: rustc::hir::FnDecl<$tcx>, - [] foreign_item: rustc::hir::ForeignItem<$tcx>, - [] impl_item_ref: rustc::hir::ImplItemRef<$tcx>, - [] inline_asm: rustc::hir::InlineAsm<$tcx>, - [] local: rustc::hir::Local<$tcx>, - [few] macro_def: rustc::hir::MacroDef<$tcx>, - [] param: rustc::hir::Param<$tcx>, - [] pat: rustc::hir::Pat<$tcx>, - [] path: rustc::hir::Path<$tcx>, - [] path_segment: rustc::hir::PathSegment<$tcx>, - [] poly_trait_ref: rustc::hir::PolyTraitRef<$tcx>, - [] qpath: rustc::hir::QPath<$tcx>, - [] stmt: rustc::hir::Stmt<$tcx>, - [] struct_field: rustc::hir::StructField<$tcx>, - [] trait_item_ref: rustc::hir::TraitItemRef, - [] ty: rustc::hir::Ty<$tcx>, - [] type_binding: rustc::hir::TypeBinding<$tcx>, - [] variant: rustc::hir::Variant<$tcx>, - [] where_predicate: rustc::hir::WherePredicate<$tcx>, + [] block: rustc_hir::Block<$tcx>, + [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>, + [few] global_asm: rustc_hir::GlobalAsm, + [] generic_arg: rustc_hir::GenericArg<$tcx>, + [] generic_args: rustc_hir::GenericArgs<$tcx>, + [] generic_bound: rustc_hir::GenericBound<$tcx>, + [] generic_param: rustc_hir::GenericParam<$tcx>, + [] expr: rustc_hir::Expr<$tcx>, + [] field: rustc_hir::Field<$tcx>, + [] field_pat: rustc_hir::FieldPat<$tcx>, + [] fn_decl: rustc_hir::FnDecl<$tcx>, + [] foreign_item: rustc_hir::ForeignItem<$tcx>, + [] impl_item_ref: rustc_hir::ImplItemRef<$tcx>, + [] inline_asm: rustc_hir::InlineAsm<$tcx>, + [] local: rustc_hir::Local<$tcx>, + [few] macro_def: rustc_hir::MacroDef<$tcx>, + [] param: rustc_hir::Param<$tcx>, + [] pat: rustc_hir::Pat<$tcx>, + [] path: rustc_hir::Path<$tcx>, + [] path_segment: rustc_hir::PathSegment<$tcx>, + [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>, + [] qpath: rustc_hir::QPath<$tcx>, + [] stmt: rustc_hir::Stmt<$tcx>, + [] struct_field: rustc_hir::StructField<$tcx>, + [] trait_item_ref: rustc_hir::TraitItemRef, + [] ty: rustc_hir::Ty<$tcx>, + [] type_binding: rustc_hir::TypeBinding<$tcx>, + [] variant: rustc_hir::Variant<$tcx>, + [] where_predicate: rustc_hir::WherePredicate<$tcx>, ], $tcx); ) } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 0dae5d05066ef..858627a1e8962 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -49,13 +49,10 @@ //! 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::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX}; use crate::hir::map::DefPathHash; -use crate::hir::HirId; +use crate::ich::{Fingerprint, StableHashingContext}; use crate::mir; use crate::mir::interpret::GlobalId; - -use crate::ich::{Fingerprint, StableHashingContext}; use crate::traits; use crate::traits::query::{ CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal, @@ -64,7 +61,10 @@ use crate::traits::query::{ }; use crate::ty::subst::SubstsRef; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; + use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX}; +use rustc_hir::HirId; use rustc_span::symbol::Symbol; use std::fmt; use std::hash::Hash; diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index 5395117ff24fc..23aef0c429830 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -1,8 +1,9 @@ //! The `DepGraphSafe` trait -use crate::hir::def_id::DefId; -use crate::hir::BodyId; use crate::ty::TyCtxt; + +use rustc_hir::def_id::DefId; +use rustc_hir::BodyId; use syntax::ast::NodeId; /// The `DepGraphSafe` trait is used to specify what kinds of values diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 08d4163add732..7395b03c4eb80 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -4,15 +4,15 @@ //! conflicts between multiple such attributes attached to the same //! item. -use crate::hir::def_id::DefId; use crate::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use crate::hir::DUMMY_HIR_ID; -use crate::hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind}; use crate::lint::builtin::UNUSED_ATTRIBUTES; use crate::ty::query::Providers; use crate::ty::TyCtxt; - use rustc_error_codes::*; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::DUMMY_HIR_ID; +use rustc_hir::{self, HirId, Item, ItemKind, TraitItem, TraitItemKind}; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast::Attribute; diff --git a/src/librustc/hir/exports.rs b/src/librustc/hir/exports.rs index a2e885f2a6a7e..db020e39e8eda 100644 --- a/src/librustc/hir/exports.rs +++ b/src/librustc/hir/exports.rs @@ -1,7 +1,7 @@ -use crate::hir::def::Res; -use crate::hir::def_id::DefIdMap; use crate::ty; +use rustc_hir::def::Res; +use rustc_hir::def_id::DefIdMap; use rustc_macros::HashStable; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 780b0e36b5e4d..edecfd335fbb7 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -31,10 +31,10 @@ //! This order consistency is required in a few places in rustc, for //! example generator inference, and possibly also HIR borrowck. -use crate::hir::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor}; use crate::hir::map::Map; -use crate::hir::*; +use rustc_hir::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor}; +use rustc_hir::*; use rustc_span::Span; use syntax::ast::{Attribute, Ident, Label, Name}; @@ -867,7 +867,7 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>( } pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FunctionRetTy<'v>) { - if let Return(ref output_ty) = *ret_ty { + if let FunctionRetTy::Return(ref output_ty) = *ret_ty { visitor.visit_ty(output_ty) } } diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 9546c101dc803..2cd44770b02cb 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -11,10 +11,10 @@ //! nested within a uniquely determined `FnLike`), and users can ask //! for the `Code` associated with a particular NodeId. -use crate::hir as ast; use crate::hir::intravisit::FnKind; use crate::hir::map; -use crate::hir::{Expr, FnDecl, Node}; +use rustc_hir as ast; +use rustc_hir::{Expr, FnDecl, Node}; use rustc_span::Span; use syntax::ast::{Attribute, Ident}; diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 25083281ce9d1..6879e8fd76348 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -1,13 +1,13 @@ use super::*; use crate::dep_graph::{DepGraph, DepKind, DepNodeIndex}; -use crate::hir; -use crate::hir::def_id::{CrateNum, DefIndex, LOCAL_CRATE}; use crate::hir::intravisit::{NestedVisitorMap, Visitor}; use crate::hir::map::HirEntryMap; use crate::ich::Fingerprint; use crate::middle::cstore::CrateStore; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::svh::Svh; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefIndex, LOCAL_CRATE}; use rustc_index::vec::IndexVec; use rustc_session::{CrateDisambiguator, Session}; use rustc_span::source_map::SourceMap; @@ -268,7 +268,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { None => format!("{:?}", node), }; - let forgot_str = if hir_id == crate::hir::DUMMY_HIR_ID { + let forgot_str = if hir_id == hir::DUMMY_HIR_ID { format!("\nMaybe you forgot to lower the node id {:?}?", node_id) } else { String::new() diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index b04c3523662eb..67d29b38db2a5 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -4,12 +4,11 @@ //! There are also some rather random cases (like const initializer //! expressions) that are mostly just leftovers. -use crate::hir; -use crate::hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::ich::Fingerprint; - use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::StableHasher; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_index::vec::IndexVec; use rustc_session::node_id::NodeMap; use rustc_session::CrateDisambiguator; diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs index a04fc8a562ffa..6329970759203 100644 --- a/src/librustc/hir/map/hir_id_validator.rs +++ b/src/librustc/hir/map/hir_id_validator.rs @@ -1,10 +1,13 @@ -use crate::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; -use crate::hir::itemlikevisit::ItemLikeVisitor; -use crate::hir::{self, intravisit, HirId, ItemLocalId}; +use crate::hir::intravisit; +use crate::hir::map::Map; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::{par_iter, Lock, ParallelIterator}; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::{HirId, ItemLocalId}; -pub fn check_crate(hir_map: &hir::map::Map<'_>) { +pub fn check_crate(hir_map: &Map<'_>) { hir_map.dep_graph.assert_ignored(); let errors = Lock::new(Vec::new()); @@ -26,19 +29,19 @@ pub fn check_crate(hir_map: &hir::map::Map<'_>) { } struct HirIdValidator<'a, 'hir> { - hir_map: &'a hir::map::Map<'hir>, + hir_map: &'a Map<'hir>, owner_def_index: Option, hir_ids_seen: FxHashSet, errors: &'a Lock>, } struct OuterVisitor<'a, 'hir> { - hir_map: &'a hir::map::Map<'hir>, + hir_map: &'a Map<'hir>, errors: &'a Lock>, } impl<'a, 'hir> OuterVisitor<'a, 'hir> { - fn new_inner_visitor(&self, hir_map: &'a hir::map::Map<'hir>) -> HirIdValidator<'a, 'hir> { + fn new_inner_visitor(&self, hir_map: &'a Map<'hir>) -> HirIdValidator<'a, 'hir> { HirIdValidator { hir_map, owner_def_index: None, diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index fc23482958357..0a165accb7d52 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -4,15 +4,16 @@ pub use self::definitions::{ }; use crate::dep_graph::{DepGraph, DepKind, DepNode, DepNodeIndex}; -use crate::hir::def::{DefKind, Res}; -use crate::hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX}; -use crate::hir::itemlikevisit::ItemLikeVisitor; -use crate::hir::print::Nested; -use crate::hir::*; +use crate::hir::intravisit; use crate::middle::cstore::CrateStoreDyn; use crate::ty::query::Providers; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::svh::Svh; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::print::Nested; +use rustc_hir::*; use rustc_index::vec::IndexVec; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::Spanned; diff --git a/src/librustc/hir.rs b/src/librustc/hir/mod.rs similarity index 52% rename from src/librustc/hir.rs rename to src/librustc/hir/mod.rs index 62160fed1bc66..3087fc3c1f2e6 100644 --- a/src/librustc/hir.rs +++ b/src/librustc/hir/mod.rs @@ -3,24 +3,11 @@ //! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html pub mod check_attr; -pub use rustc_hir::def; pub mod exports; -pub use rustc_hir::def_id; -pub use rustc_hir::hir_id::*; pub mod intravisit; -pub use rustc_hir::itemlikevisit; pub mod map; -pub use rustc_hir::pat_util; -pub use rustc_hir::print; pub mod upvars; -pub use rustc_hir::BlockCheckMode::*; -pub use rustc_hir::FunctionRetTy::*; -pub use rustc_hir::PrimTy::*; -pub use rustc_hir::UnOp::*; -pub use rustc_hir::UnsafeSource::*; -pub use rustc_hir::*; - use crate::ty::query::Providers; pub fn provide(providers: &mut Providers<'_>) { diff --git a/src/librustc/hir/upvars.rs b/src/librustc/hir/upvars.rs index ff6b0541078b7..df02a79ef4cc2 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc/hir/upvars.rs @@ -1,11 +1,12 @@ //! Upvar (closure capture) collection from cross-body HIR uses of `Res::Local`s. -use crate::hir::def::Res; use crate::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use crate::hir::{self, HirId}; use crate::ty::query::Providers; use crate::ty::TyCtxt; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; +use rustc_hir as hir; +use rustc_hir::def::Res; +use rustc_hir::{self, HirId}; use rustc_span::Span; pub fn provide(providers: &mut Providers<'_>) { diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 86cad00af17a8..aade4c3f74c54 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -1,5 +1,3 @@ -use crate::hir; -use crate::hir::def_id::{DefId, DefIndex}; use crate::hir::map::definitions::Definitions; use crate::hir::map::DefPathHash; use crate::ich::{self, CachingSourceMapView}; @@ -7,17 +5,18 @@ use crate::middle::cstore::CrateStore; use crate::session::Session; use crate::ty::{fast_reject, TyCtxt}; -use std::cmp::Ord; - +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; +use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIndex}; use rustc_span::source_map::SourceMap; use rustc_span::symbol::Symbol; use rustc_span::{BytePos, SourceFile}; use syntax::ast; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; -use rustc_data_structures::sync::Lrc; use smallvec::SmallVec; +use std::cmp::Ord; fn compute_ignored_attr_names() -> FxHashSet { debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0); diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index f69051fd85dd2..8961f7cd4bc95 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1,12 +1,11 @@ //! This module contains `HashStable` implementations for various HIR data //! types in no particular order. -use crate::hir; -use crate::hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX}; use crate::hir::map::DefPathHash; use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext}; - 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 smallvec::SmallVec; use std::mem; use syntax::attr; diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index e72a5241fadb1..e1733794b8d72 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -3,12 +3,11 @@ use crate::ich::StableHashingContext; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc_span::SourceFile; use syntax::ast; -use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; - -use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use smallvec::SmallVec; impl<'ctx> rustc_target::HashStableContext for StableHashingContext<'ctx> {} diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index a9e56a9264cf9..5d765a2a3d3e7 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -32,7 +32,6 @@ use super::unify_key::{ConstVarValue, ConstVariableValue}; use super::unify_key::{ConstVariableOrigin, ConstVariableOriginKind}; use super::{InferCtxt, MiscVariable, TypeTrace}; -use crate::hir::def_id::DefId; use crate::traits::{Obligation, PredicateObligations}; use crate::ty::error::TypeError; use crate::ty::relate::{self, Relate, RelateResult, TypeRelation}; @@ -40,6 +39,7 @@ use crate::ty::subst::SubstsRef; use crate::ty::{self, InferConst, Ty, TyCtxt}; use crate::ty::{IntType, UintType}; +use rustc_hir::def_id::DefId; use rustc_span::{Span, DUMMY_SP}; use syntax::ast; diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index 6a7707b3c0ad1..4a41cdb14071b 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -1,13 +1,13 @@ use super::combine::{CombineFields, RelationDir}; use super::Subtype; -use crate::hir::def_id::DefId; - use crate::ty::relate::{self, Relate, RelateResult, TypeRelation}; use crate::ty::subst::SubstsRef; use crate::ty::TyVar; use crate::ty::{self, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; + /// Ensures `a` is made equal to `b`. Returns `a` on success. pub struct Equate<'combine, 'infcx, 'tcx> { fields: &'combine mut CombineFields<'infcx, 'tcx>, diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index e2b70abe6f0f5..e161ecfa7fa77 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -49,9 +49,7 @@ use super::lexical_region_resolve::RegionResolutionError; use super::region_constraints::GenericKind; use super::{InferCtxt, RegionVariableOrigin, SubregionOrigin, TypeTrace, ValuePairs}; -use crate::hir; -use crate::hir::def_id::DefId; -use crate::hir::Node; +use crate::hir::map; use crate::infer::opaque_types; use crate::infer::{self, SuppressRegionErrors}; use crate::middle::region; @@ -64,6 +62,9 @@ use crate::ty::{ subst::{Subst, SubstsRef}, Region, Ty, TyCtxt, TypeFoldable, }; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Node; use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString}; use rustc_error_codes::*; @@ -455,7 +456,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { terr: &TypeError<'tcx>, ) { use hir::def_id::CrateNum; - use hir::map::DisambiguatedDefPathData; + use map::DisambiguatedDefPathData; use ty::print::Printer; use ty::subst::GenericArg; @@ -851,7 +852,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { sig2: &ty::PolyFnSig<'tcx>, ) -> (DiagnosticStyledString, DiagnosticStyledString) { let get_lifetimes = |sig| { - use crate::hir::def::Namespace; + use rustc_hir::def::Namespace; let mut s = String::new(); let (_, (sig, reg)) = ty::print::FmtPrinter::new(self.tcx, &mut s, Namespace::TypeNS) .name_all_regions(sig) diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index 889b7b4db3305..091bfba7ca677 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -1,11 +1,13 @@ -use crate::hir::def::{DefKind, Namespace}; use crate::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use crate::hir::{self, Body, Expr, ExprKind, FunctionRetTy, HirId, Local, Pat}; +use crate::hir::map::Map; use crate::infer::type_variable::TypeVariableOriginKind; use crate::infer::InferCtxt; use crate::ty::print::Print; use crate::ty::{self, DefIdTree, Infer, Ty, TyVar}; use errors::{Applicability, DiagnosticBuilder}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Namespace}; +use rustc_hir::{Body, Expr, ExprKind, FunctionRetTy, HirId, Local, Pat}; use rustc_span::source_map::DesugaringKind; use rustc_span::symbol::kw; use rustc_span::Span; @@ -16,7 +18,7 @@ use rustc_error_codes::*; struct FindLocalByTypeVisitor<'a, 'tcx> { infcx: &'a InferCtxt<'a, 'tcx>, target_ty: Ty<'tcx>, - hir_map: &'a hir::map::Map<'tcx>, + hir_map: &'a Map<'tcx>, found_local_pattern: Option<&'tcx Pat<'tcx>>, found_arg_pattern: Option<&'tcx Pat<'tcx>>, found_ty: Option>, @@ -25,11 +27,7 @@ struct FindLocalByTypeVisitor<'a, 'tcx> { } impl<'a, 'tcx> FindLocalByTypeVisitor<'a, 'tcx> { - fn new( - infcx: &'a InferCtxt<'a, 'tcx>, - target_ty: Ty<'tcx>, - hir_map: &'a hir::map::Map<'tcx>, - ) -> Self { + fn new(infcx: &'a InferCtxt<'a, 'tcx>, target_ty: Ty<'tcx>, hir_map: &'a Map<'tcx>) -> Self { Self { infcx, target_ty, diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index 0b226336faca3..6edf8f1e78755 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -1,9 +1,9 @@ -use crate::hir; use crate::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use crate::hir::Node; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::middle::resolve_lifetime as rl; use crate::ty::{self, Region, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::Node; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// This function calls the `visit_ty` method for the parameters diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 94b8d16668a3f..0d56fc57230e3 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -1,9 +1,9 @@ //! Error Reporting for Anonymous Region Lifetime Errors //! where one region is named and the other is anonymous. -use crate::hir::{FunctionRetTy, TyKind}; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::ty; use errors::{Applicability, DiagnosticBuilder}; +use rustc_hir::{FunctionRetTy, TyKind}; use rustc_error_codes::*; diff --git a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs index 8914ff8add8d7..af0e5ef8005af 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs @@ -1,13 +1,12 @@ //! Error Reporting for Anonymous Region Lifetime Errors //! where both the regions are anonymous. -use crate::hir::Node; -use crate::hir::{Expr, ExprKind::Closure}; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError::SubSupConflict; use crate::infer::SubregionOrigin; use crate::ty::RegionKind; use crate::util::common::ErrorReported; +use rustc_hir::{Expr, ExprKind::Closure, Node}; impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// Print the error message for lifetime errors when binding escapes a closure. diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index e6758f6596d50..f276dab5000bc 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -1,5 +1,3 @@ -use crate::hir::def::Namespace; -use crate::hir::def_id::DefId; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError; use crate::infer::ValuePairs; @@ -10,6 +8,8 @@ use crate::ty::print::{FmtPrinter, Print, RegionHighlightMode}; use crate::ty::subst::SubstsRef; use crate::ty::{self, TyCtxt}; use errors::DiagnosticBuilder; +use rustc_hir::def::Namespace; +use rustc_hir::def_id::DefId; use std::fmt::{self, Write}; diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index ece55c4a822f6..52ccb1454ee2b 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -1,10 +1,10 @@ //! Helper functions corresponding to lifetime errors due to //! anonymous regions. -use crate::hir; -use crate::hir::def_id::DefId; use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::ty::{self, DefIdTree, Region, Ty}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::Span; // The struct contains the information about the anonymous region diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs index b7a3ff6987cb5..a930e707c5c15 100644 --- a/src/librustc/infer/lexical_region_resolve/graphviz.rs +++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs @@ -9,13 +9,13 @@ use graphviz as dot; use super::Constraint; -use crate::hir::def_id::DefIndex; use crate::infer::region_constraints::RegionConstraintData; use crate::infer::SubregionOrigin; use crate::middle::free_region::RegionRelations; use crate::middle::region; use crate::ty; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def_id::DefIndex; use std::borrow::Cow; use std::collections::btree_map::BTreeMap; diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 3fd5d3b5de4f2..e78382c0a3234 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -1,6 +1,5 @@ //! Lexical region resolution. -use crate::hir::def_id::DefId; use crate::infer::region_constraints::Constraint; use crate::infer::region_constraints::GenericKind; use crate::infer::region_constraints::MemberConstraint; @@ -19,6 +18,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{ Direction, Graph, NodeIndex, INCOMING, OUTGOING, }; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::Span; diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 5c11659b550ce..4eb8d79a067ef 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -7,8 +7,6 @@ pub use self::SubregionOrigin::*; pub use self::ValuePairs::*; pub use crate::ty::IntVarValue; -use crate::hir; -use crate::hir::def_id::DefId; use crate::infer::canonical::{Canonical, CanonicalVarValues}; use crate::infer::unify_key::{ConstVarValue, ConstVariableValue}; use crate::middle::free_region::RegionRelations; @@ -27,6 +25,8 @@ use errors::DiagnosticBuilder; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::Symbol; use rustc_span::Span; use std::cell::{Cell, Ref, RefCell, RefMut}; diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 638ab01baac70..e9b1ebbd3f643 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -1,6 +1,3 @@ -use crate::hir; -use crate::hir::def_id::{DefId, DefIdMap}; -use crate::hir::Node; use crate::infer::outlives::free_region_map::FreeRegionRelations; use crate::infer::{self, InferCtxt, InferOk, TypeVariableOrigin, TypeVariableOriginKind}; use crate::middle::region; @@ -12,6 +9,9 @@ use errors::DiagnosticBuilder; use rustc::session::config::nightly_options; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIdMap}; +use rustc_hir::Node; use rustc_span::Span; use rustc_error_codes::*; diff --git a/src/librustc/infer/outlives/env.rs b/src/librustc/infer/outlives/env.rs index e27f1a8b26d7f..130cffe502287 100644 --- a/src/librustc/infer/outlives/env.rs +++ b/src/librustc/infer/outlives/env.rs @@ -1,9 +1,9 @@ -use crate::hir; use crate::infer::outlives::free_region_map::FreeRegionMap; use crate::infer::{GenericKind, InferCtxt}; use crate::traits::query::outlives_bounds::{self, OutlivesBound}; use crate::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; use rustc_span::Span; /// The `OutlivesEnvironment` collects information about what outlives diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 4bafd2ebf40a1..45e4a84589eb5 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -59,7 +59,6 @@ //! might later infer `?U` to something like `&'b u32`, which would //! imply that `'b: 'a`. -use crate::hir; use crate::infer::outlives::env::RegionBoundPairs; use crate::infer::outlives::verify::VerifyBoundCx; use crate::infer::{self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, VerifyBound}; @@ -68,6 +67,7 @@ use crate::ty::outlives::Component; use crate::ty::subst::GenericArgKind; use crate::ty::{self, Region, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { /// Registers that the given region obligation must be resolved diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 828d4c2e0e760..0380d0e35e78d 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -1,10 +1,10 @@ -use crate::hir::def_id::DefId; use crate::infer::outlives::env::RegionBoundPairs; use crate::infer::{GenericKind, VerifyBound}; use crate::traits; use crate::ty::subst::{InternalSubsts, Subst}; use crate::ty::{self, Ty, TyCtxt}; use crate::util::captures::Captures; +use rustc_hir::def_id::DefId; /// The `TypeOutlives` struct has the job of "lowering" a `T: 'a` /// obligation into a series of `'a: 'b` constraints and "verifys", as diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 323aa1f7f01cd..f218bf1134f7f 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -6,7 +6,6 @@ use self::UndoLog::*; use super::unify_key; use super::{MiscVariable, RegionVariableOrigin, SubregionOrigin}; -use crate::hir::def_id::DefId; use crate::ty::ReStatic; use crate::ty::{self, Ty, TyCtxt}; use crate::ty::{ReLateBound, ReVar}; @@ -14,6 +13,7 @@ use crate::ty::{Region, RegionVid}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::unify as ut; +use rustc_hir::def_id::DefId; use rustc_index::vec::IndexVec; use rustc_span::Span; diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 27bcb63fe15fe..089c6dd723bce 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -1,5 +1,5 @@ -use crate::hir::def_id::DefId; use crate::ty::{self, Ty, TyVid}; +use rustc_hir::def_id::DefId; use rustc_span::symbol::Symbol; use rustc_span::Span; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index ca6a7beb48ed4..0ac682428d632 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -16,8 +16,6 @@ use self::TargetLint::*; -use crate::hir; -use crate::hir::def_id::{CrateNum, DefId}; use crate::hir::map::{definitions::DisambiguatedDefPathData, DefPathData}; use crate::lint::builtin::BuiltinLintDiagnostics; use crate::lint::levels::{LintLevelSets, LintLevelsBuilder}; @@ -30,6 +28,8 @@ use crate::ty::{self, print::Printer, subst::GenericArg, Ty, TyCtxt}; use errors::DiagnosticBuilder; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId}; use rustc_span::{symbol::Symbol, MultiSpan, Span}; use std::slice; use syntax::ast; diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs index f7dfbab92e613..69f212a9a3098 100644 --- a/src/librustc/lint/internal.rs +++ b/src/librustc/lint/internal.rs @@ -1,12 +1,12 @@ //! Some lints that are only useful in the compiler or crates that use compiler internals, such as //! Clippy. -use crate::hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind}; use crate::lint::{ EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass, }; use errors::Applicability; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind}; use rustc_session::declare_tool_lint; use rustc_span::symbol::{sym, Symbol}; use syntax::ast::{Ident, Item, ItemKind}; diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 40e6f22c25f3d..78d01ff4fedfc 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -1,6 +1,5 @@ use std::cmp; -use crate::hir::HirId; use crate::ich::StableHashingContext; use crate::lint::builtin; use crate::lint::context::{CheckLintNameResult, LintStore}; @@ -9,6 +8,7 @@ use crate::session::Session; use errors::{Applicability, DiagnosticBuilder}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::HirId; use rustc_span::source_map::MultiSpan; use rustc_span::symbol::{sym, Symbol}; use syntax::ast; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 3c55669231301..2147ff1a24592 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -23,10 +23,10 @@ pub use self::LintSource::*; use rustc_data_structures::sync; -use crate::hir; use crate::lint::builtin::BuiltinLintDiagnostics; use crate::ty::TyCtxt; use errors::{DiagnosticBuilder, DiagnosticId}; +use rustc_hir as hir; use rustc_session::node_id::NodeMap; use rustc_session::{DiagnosticMessageId, Session}; use rustc_span::hygiene::MacroKind; @@ -109,13 +109,13 @@ macro_rules! late_lint_methods { fn check_where_predicate(a: &$hir hir::WherePredicate<$hir>); fn check_poly_trait_ref(a: &$hir hir::PolyTraitRef<$hir>, b: hir::TraitBoundModifier); fn check_fn( - a: hir::intravisit::FnKind<$hir>, + a: $crate::hir::intravisit::FnKind<$hir>, b: &$hir hir::FnDecl<$hir>, c: &$hir hir::Body<$hir>, d: Span, e: hir::HirId); fn check_fn_post( - a: hir::intravisit::FnKind<$hir>, + a: $crate::hir::intravisit::FnKind<$hir>, b: &$hir hir::FnDecl<$hir>, c: &$hir hir::Body<$hir>, d: Span, diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index be7603f258a19..ee43c35c1d05b 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -2,15 +2,15 @@ //! are *mostly* used as a part of that interface, but these should //! probably get a better home if someone can find one. -use crate::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use crate::hir::map as hir_map; use crate::hir::map::definitions::{DefKey, DefPathTable}; use crate::session::search_paths::PathKind; use crate::session::{CrateDisambiguator, Session}; use crate::ty::{self, TyCtxt}; -use rustc_data_structures::svh::Svh; +use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_macros::HashStable; use rustc_span::symbol::Symbol; use rustc_span::Span; diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index 756af9be6573f..e4af54f7771ea 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -1,8 +1,8 @@ -use crate::hir::def_id::{DefId, LOCAL_CRATE}; use crate::ich::StableHashingContext; use crate::ty::subst::SubstsRef; use crate::ty::{self, TyCtxt}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use std::cmp; use std::mem; diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index e6c51cc7c0844..253e00f9e4db5 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -3,10 +3,10 @@ //! or explicit bounds. In that case, we track the bounds using the `TransitiveRelation` type, //! and use that to decide when one free region outlives another, and so forth. -use crate::hir::def_id::DefId; use crate::infer::outlives::free_region_map::{FreeRegionMap, FreeRegionRelations}; use crate::middle::region; use crate::ty::{self, Region, TyCtxt}; +use rustc_hir::def_id::DefId; /// Combines a `region::ScopeTree` (which governs relationships between /// scopes) and a `FreeRegionMap` (which governs relationships between diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 0e9a2a39fd912..220560a67e088 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -9,15 +9,15 @@ pub use self::LangItem::*; -use crate::hir; use crate::hir::check_attr::Target; -use crate::hir::def_id::DefId; -use crate::hir::itemlikevisit::ItemLikeVisitor; use crate::middle::cstore::ExternCrate; use crate::middle::weak_lang_items; use crate::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_macros::HashStable; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index c4da4d75f4de2..4756e83b5e980 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -2,10 +2,9 @@ //! outside their scopes. This pass will also generate a set of exported items //! which are available for use externally when compiled as a library. -use crate::hir::def_id::DefIdSet; -use crate::hir::HirId; - use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::DefIdSet; +use rustc_hir::HirId; use rustc_macros::HashStable; use std::fmt; use std::hash::Hash; diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index ee96b595f6fde..b2a5efca92df3 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -6,11 +6,11 @@ //! //! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html -use crate::hir; -use crate::hir::def_id::DefId; -use crate::hir::Node; use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::ty::{self, DefIdTree, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Node; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 951181c8900ce..c21ba1b3bd2db 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1,11 +1,11 @@ //! Name resolution for lifetimes: type declarations. -use crate::hir::def_id::{DefId, LocalDefId}; -use crate::hir::{GenericParam, ItemLocalId}; -use crate::hir::{GenericParamKind, LifetimeParamKind}; use crate::ty; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def_id::{DefId, LocalDefId}; +use rustc_hir::{GenericParam, ItemLocalId}; +use rustc_hir::{GenericParamKind, LifetimeParamKind}; use rustc_macros::HashStable; /// The origin of a named lifetime definition. diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 0c756c71fbdf6..a29b1b48c24f9 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -3,17 +3,17 @@ pub use self::StabilityLevel::*; -use crate::hir::def::DefKind; -use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; -use crate::hir::{self, HirId}; use crate::lint::builtin::BuiltinLintDiagnostics; use crate::lint::{self, in_derive_expansion, Lint}; use crate::session::{DiagnosticMessageId, Session}; use crate::ty::{self, TyCtxt}; - use errors::DiagnosticBuilder; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_feature::GateIssue; +use rustc_hir as hir; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; +use rustc_hir::{self, HirId}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::{MultiSpan, Span}; use syntax::ast::CRATE_NODE_ID; diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index bdf34e8d76540..8e6ac165fab17 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -3,12 +3,12 @@ use crate::middle::lang_items; use crate::session::config; -use crate::hir; -use crate::hir::def_id::DefId; use crate::hir::intravisit; use crate::hir::intravisit::{NestedVisitorMap, Visitor}; use crate::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use rustc_target::spec::PanicStrategy; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index dddc3cf9f5b70..f54b9231d1acf 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -1,6 +1,5 @@ use super::{CheckInAllocMsg, Pointer, RawConst, ScalarMaybeUndef}; -use crate::hir; use crate::hir::map::definitions::DefPathData; use crate::mir; use crate::ty::layout::{Align, LayoutError, Size}; @@ -10,6 +9,7 @@ use crate::ty::{self, layout, Ty}; use backtrace::Backtrace; use errors::DiagnosticBuilder; use hir::GeneratorKind; +use rustc_hir as hir; use rustc_macros::HashStable; use rustc_span::symbol::Symbol; use rustc_span::{Pos, Span}; diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 185fa4cf9416f..99113d6ef1836 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -115,7 +115,6 @@ pub use self::allocation::{Allocation, AllocationExtra, Relocations, UndefMask}; pub use self::pointer::{CheckInAllocMsg, Pointer, PointerArithmetic}; -use crate::hir::def_id::DefId; use crate::mir; use crate::ty::codec::TyDecoder; use crate::ty::layout::{self, Size}; @@ -125,6 +124,7 @@ use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock}; use rustc_data_structures::tiny_list::TinyList; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; use rustc_serialize::{Decodable, Encodable, Encoder}; use std::fmt; diff --git a/src/librustc/mir/interpret/queries.rs b/src/librustc/mir/interpret/queries.rs index b560363c95861..161c9a3fcc1f7 100644 --- a/src/librustc/mir/interpret/queries.rs +++ b/src/librustc/mir/interpret/queries.rs @@ -1,9 +1,9 @@ use super::{ConstEvalResult, ErrorHandled, GlobalId}; -use crate::hir::def_id::DefId; use crate::mir; use crate::ty::subst::{InternalSubsts, SubstsRef}; use crate::ty::{self, TyCtxt}; +use rustc_hir::def_id::DefId; use rustc_span::Span; impl<'tcx> TyCtxt<'tcx> { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index a293fd128bdb0..ff64302b1e506 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -4,9 +4,6 @@ //! //! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/index.html -use crate::hir::def::{CtorKind, Namespace}; -use crate::hir::def_id::DefId; -use crate::hir::{self, GeneratorKind}; use crate::mir::interpret::{GlobalAlloc, PanicInfo, Scalar}; use crate::mir::visit::MirVisitable; use crate::ty::adjustment::PointerCast; @@ -17,6 +14,10 @@ use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::{ self, AdtDef, CanonicalUserTypeAnnotations, List, Region, Ty, TyCtxt, UserTypeAnnotationIndex, }; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, Namespace}; +use rustc_hir::def_id::DefId; +use rustc_hir::{self, GeneratorKind}; use polonius_engine::Atom; use rustc_data_structures::fx::FxHashSet; diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 2dbe1d4fa5c49..51ce575e51f3b 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -1,6 +1,4 @@ use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId}; -use crate::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use crate::hir::HirId; use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext}; use crate::session::config::OptLevel; use crate::ty::print::obsolete::DefPathBasedNames; @@ -8,6 +6,8 @@ use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt use rustc_data_structures::base_n; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::HirId; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; use std::fmt; diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 234221130d832..77f3ff47ff247 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -3,12 +3,12 @@ * building is complete. */ -use crate::hir; use crate::mir::*; use crate::ty::layout::VariantIdx; use crate::ty::subst::Subst; use crate::ty::util::IntTypeExt; use crate::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; #[derive(Copy, Clone, Debug, TypeFoldable)] pub struct PlaceTy<'tcx> { diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index e81497351cabb..4a2ec9b9687f3 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -1,5 +1,4 @@ use crate::dep_graph::{DepKind, DepNode, RecoverKey, SerializedDepNodeIndex}; -use crate::hir::def_id::{CrateNum, DefId, DefIndex}; use crate::mir; use crate::mir::interpret::GlobalId; use crate::traits; @@ -12,6 +11,7 @@ use crate::ty::query::queries; use crate::ty::query::QueryDescription; use crate::ty::subst::SubstsRef; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex}; use rustc_span::symbol::Symbol; use std::borrow::Cow; diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 16bf69f9ad04c..db7cda3b95bb2 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -4,7 +4,6 @@ //! [trait-resolution]: https://rust-lang.github.io/rustc-guide/traits/resolution.html //! [trait-specialization]: https://rust-lang.github.io/rustc-guide/traits/specialization.html -use crate::hir::def_id::{DefId, LOCAL_CRATE}; use crate::infer::{CombinedSnapshot, InferOk}; use crate::traits::select::IntercrateAmbiguityCause; use crate::traits::IntercrateMode; @@ -12,6 +11,7 @@ use crate::traits::{self, Normalized, Obligation, ObligationCause, SelectionCont use crate::ty::fold::TypeFoldable; use crate::ty::subst::Subst; use crate::ty::{self, Ty, TyCtxt}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index b664540402605..5b804480119fe 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -1,7 +1,7 @@ -use crate::hir::def_id::DefId; use crate::infer::InferCtxt; use crate::traits::Obligation; use crate::ty::{self, ToPredicate, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; use super::{ChalkFulfillmentContext, FulfillmentContext, FulfillmentError}; use super::{ObligationCause, PredicateObligation}; diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 3fef1dd064edb..238371ee7747d 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -6,9 +6,6 @@ use super::{ TraitNotObjectSafe, }; -use crate::hir; -use crate::hir::def_id::DefId; -use crate::hir::Node; use crate::infer::error_reporting::TypeAnnotationNeeded as ErrorCode; use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::infer::{self, InferCtxt}; @@ -21,10 +18,11 @@ use crate::ty::GenericParamDefKind; use crate::ty::SubtypePredicate; use crate::ty::TypeckTables; use crate::ty::{self, AdtKind, DefIdTree, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; - use errors::{pluralize, Applicability, DiagnosticBuilder, Style}; -use rustc::hir::def_id::LOCAL_CRATE; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::Node; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, sym}; use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 5c44d5bda39b2..3ba673d1a7d49 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -19,8 +19,6 @@ mod specialize; mod structural_impls; mod util; -use crate::hir; -use crate::hir::def_id::DefId; use crate::infer::outlives::env::OutlivesEnvironment; use crate::infer::{InferCtxt, SuppressRegionErrors}; use crate::middle::region; @@ -31,6 +29,8 @@ use crate::ty::subst::{InternalSubsts, SubstsRef}; use crate::ty::{self, AdtKind, GenericParamDefKind, List, ToPredicate, Ty, TyCtxt}; use crate::util::common::ErrorReported; use chalk_engine; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; use rustc_span::{Span, DUMMY_SP}; use syntax::ast; diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 30ffdc23d9893..836e67cff8b2c 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -10,12 +10,12 @@ use super::elaborate_predicates; -use crate::hir; -use crate::hir::def_id::DefId; use crate::lint; use crate::traits::{self, Obligation, ObligationCause}; use crate::ty::subst::{InternalSubsts, Subst}; use crate::ty::{self, Predicate, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; use std::borrow::Cow; diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index f1a04da188ba0..92984b48ae938 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -1,10 +1,9 @@ use fmt_macros::{Parser, Piece, Position}; -use crate::hir::def_id::DefId; use crate::ty::{self, GenericParamDefKind, TyCtxt}; use crate::util::common::ErrorReported; - use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::DefId; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use syntax::ast::{MetaItem, NestedMetaItem}; diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index c29011c7cc378..22bfba37443fd 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -12,7 +12,6 @@ use super::SelectionContext; use super::SelectionError; use super::{VtableClosureData, VtableFnPointerData, VtableGeneratorData, VtableImplData}; -use crate::hir::def_id::DefId; use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use crate::ty::fold::{TypeFoldable, TypeFolder}; @@ -20,6 +19,7 @@ use crate::ty::subst::{InternalSubsts, Subst}; use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt}; use crate::util::common::FN_OUTPUT_NAME; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; use rustc_span::symbol::sym; use rustc_span::DUMMY_SP; diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index 6a0bc167c078e..07e57e847b13d 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -1,9 +1,9 @@ -use crate::hir; use crate::infer::canonical::OriginalQueryValues; use crate::infer::InferCtxt; use crate::traits::query::NoSolution; use crate::traits::{FulfillmentContext, ObligationCause, TraitEngine, TraitEngineExt}; use crate::ty::{self, Ty}; +use rustc_hir as hir; use rustc_span::source_map::Span; use crate::ich::StableHashingContext; diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index e183a5a54702d..46b656eb94548 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -1,8 +1,8 @@ -use crate::hir::def_id::DefId; use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse}; use crate::traits::query::Fallible; use crate::ty::subst::UserSubsts; use crate::ty::{ParamEnvAnd, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)] pub struct AscribeUserType<'tcx> { diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 0d35ad2a4cdda..94d5723778a9a 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -30,17 +30,17 @@ use super::{ }; use crate::dep_graph::{DepKind, DepNodeIndex}; -use crate::hir::def_id::DefId; use crate::infer::{CombinedSnapshot, InferCtxt, InferOk, PlaceholderMap, TypeFreshener}; use crate::middle::lang_items; use crate::ty::fast_reject; use crate::ty::relate::TypeRelation; use crate::ty::subst::{Subst, SubstsRef}; use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_hir::def_id::DefId; -use crate::hir; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lock; +use rustc_hir as hir; use rustc_index::bit_set::GrowableBitSet; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 9d3e9e309c697..520cd3e38520a 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -11,7 +11,6 @@ pub mod specialization_graph; -use crate::hir::def_id::DefId; use crate::infer::{InferCtxt, InferOk}; use crate::lint; use crate::traits::select::IntercrateAmbiguityCause; @@ -19,6 +18,7 @@ use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCau use crate::ty::subst::{InternalSubsts, Subst, SubstsRef}; use crate::ty::{self, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def_id::DefId; use rustc_span::DUMMY_SP; use super::util::impl_trait_ref_and_oblig; diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 200c2188ac360..c176f139bf868 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -1,12 +1,12 @@ use super::OverlapError; -use crate::hir::def_id::{DefId, DefIdMap}; use crate::ich::{self, StableHashingContext}; use crate::traits; use crate::ty::fast_reject::{self, SimplifiedType}; use crate::ty::{self, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::{DefId, DefIdMap}; use syntax::ast::Ident; /// A per-trait graph of impls in specialization order. At the moment, this diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 9951311782849..14cfe7cda4e28 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -2,12 +2,12 @@ use errors::DiagnosticBuilder; use rustc_span::Span; use smallvec::SmallVec; -use crate::hir; -use crate::hir::def_id::DefId; use crate::ty::outlives::Component; use crate::ty::subst::{GenericArg, Subst, SubstsRef}; use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use super::{Normalized, Obligation, ObligationCause, PredicateObligation, SelectionContext}; diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index e1b63a6d9e703..ebefb03b813f2 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -1,7 +1,7 @@ -use crate::hir; -use crate::hir::def_id::DefId; use crate::ty::subst::SubstsRef; use crate::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; #[derive(Clone, Copy, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)] diff --git a/src/librustc/ty/binding.rs b/src/librustc/ty/binding.rs index 222950785acd8..5ee8811509098 100644 --- a/src/librustc/ty/binding.rs +++ b/src/librustc/ty/binding.rs @@ -1,6 +1,6 @@ -use crate::hir::BindingAnnotation; -use crate::hir::BindingAnnotation::*; -use crate::hir::Mutability; +use rustc_hir::BindingAnnotation; +use rustc_hir::BindingAnnotation::*; +use rustc_hir::Mutability; #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum BindingMode { diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 3ccbc096d02c2..9b2714082f1e1 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -7,12 +7,12 @@ // persisting to incr. comp. caches. use crate::arena::ArenaAllocatable; -use crate::hir::def_id::{CrateNum, DefId}; use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos}; use crate::mir::{self, interpret::Allocation}; use crate::ty::subst::SubstsRef; use crate::ty::{self, List, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::{CrateNum, DefId}; use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder}; use rustc_span::Span; use std::hash::Hash; @@ -353,7 +353,7 @@ macro_rules! implement_ty_decoder { use $crate::ty; use $crate::ty::codec::*; use $crate::ty::subst::SubstsRef; - use $crate::hir::def_id::{CrateNum}; + use rustc_hir::def_id::{CrateNum}; use rustc_span::Span; diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 518ad63bdd0ae..cc5131cb21795 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -1,8 +1,8 @@ -use crate::hir; -use crate::hir::def_id::DefId; use crate::hir::map::blocks::FnLikeNode; use crate::ty::query::Providers; use crate::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::Symbol; use rustc_target::spec::abi::Abi; use syntax::attr; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 86042d86b939c..a2e5edb67fc67 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -3,13 +3,9 @@ use crate::arena::Arena; use crate::dep_graph::DepGraph; use crate::dep_graph::{self, DepConstructor, DepNode}; -use crate::hir::def::{DefKind, Res}; -use crate::hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE}; use crate::hir::exports::Export; use crate::hir::map as hir_map; use crate::hir::map::DefPathHash; -use crate::hir::{self, HirId, Node, TraitCandidate}; -use crate::hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet}; use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos}; use crate::infer::outlives::free_region_map::FreeRegionMap; @@ -48,6 +44,11 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr use crate::ty::{InferConst, ParamConst}; use crate::ty::{List, TyKind, TyS}; use crate::util::common::ErrorReported; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex, LOCAL_CRATE}; +use rustc_hir::{HirId, Node, TraitCandidate}; +use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet}; use arena::SyncDroplessArena; use errors::DiagnosticBuilder; diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index e2ecfd13d2f85..25fc484cd5301 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -1,6 +1,6 @@ -use crate::hir; -use crate::hir::def_id::DefId; use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use errors::{Applicability, DiagnosticBuilder}; use rustc_span::Span; diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index f5dce6b3958a2..5aa8bd9df2aef 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -1,7 +1,7 @@ -use crate::hir::def_id::DefId; use crate::ich::StableHashingContext; use crate::ty::{self, Ty, TyCtxt}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::DefId; use std::fmt::Debug; use std::hash::Hash; use std::mem; diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 7004cec8a31ce..b16db6ae5b18d 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -31,8 +31,8 @@ //! These methods return true to indicate that the visitor has found what it is //! looking for, and does not need to visit anything else. -use crate::hir::def_id::DefId; use crate::ty::{self, flags::FlagComputation, Binder, Ty, TyCtxt, TypeFlags}; +use rustc_hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; use std::collections::BTreeMap; diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 5a2e19156535a..14ead77653c32 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -1,6 +1,6 @@ use crate::ty::context::TyCtxt; use crate::ty::{DefId, DefIdTree}; -use rustc::hir::CRATE_HIR_ID; +use rustc_hir::CRATE_HIR_ID; use smallvec::SmallVec; use std::mem; diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index a7e716ad7b730..423fc274ade1d 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -1,10 +1,10 @@ -use crate::hir::def::Namespace; -use crate::hir::def_id::DefId; use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; use crate::middle::lang_items::DropInPlaceFnLangItem; use crate::traits; use crate::ty::print::{FmtPrinter, Printer}; use crate::ty::{self, SubstsRef, Ty, TyCtxt, TypeFoldable}; +use rustc_hir::def::Namespace; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; use rustc_target::spec::abi::Abi; diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 63345f828e09c..663de36e8397d 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -12,11 +12,11 @@ use std::iter; use std::mem; use std::ops::Bound; -use crate::hir; use crate::ich::StableHashingContext; use crate::mir::{GeneratorLayout, GeneratorSavedLocal}; use crate::ty::subst::Subst; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir as hir; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 1ce74a61c0e42..1698a0685b7aa 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -6,11 +6,9 @@ pub use self::BorrowKind::*; pub use self::IntVarValue::*; pub use self::Variance::*; -use crate::hir::def::{CtorKind, CtorOf, DefKind, Res}; -use crate::hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir::exports::ExportMap; -use crate::hir::Node; -use crate::hir::{map as hir_map, GlobMap, TraitMap}; +use crate::hir::map as hir_map; + use crate::ich::Fingerprint; use crate::ich::StableHashingContext; use crate::infer::canonical::Canonical; @@ -31,16 +29,23 @@ use crate::ty::walk::TypeWalker; use crate::util::captures::Captures; use arena::SyncDroplessArena; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::svh::Svh; -use rustc_macros::HashStable; -use rustc_session::node_id::{NodeMap, NodeSet}; - use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator}; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::{GlobMap, Node, TraitMap}; +use rustc_index::vec::{Idx, IndexVec}; +use rustc_macros::HashStable; use rustc_serialize::{self, Encodable, Encoder}; +use rustc_session::node_id::{NodeMap, NodeSet}; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::Span; use rustc_target::abi::Align; +use smallvec; use std::cell::RefCell; use std::cmp::{self, Ordering}; use std::fmt; @@ -52,13 +57,6 @@ use std::{mem, ptr}; use syntax::ast::{self, Ident, Name, NodeId}; use syntax::attr; -use rustc_data_structures::fx::FxIndexMap; -use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_index::vec::{Idx, IndexVec}; -use smallvec; - -use crate::hir; - pub use self::sty::BoundRegion::*; pub use self::sty::InferTy::*; pub use self::sty::RegionKind; @@ -3313,7 +3311,7 @@ fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync { let node = tcx.hir().get(hir_id); - let fn_like = hir::map::blocks::FnLikeNode::from_node(node).unwrap_or_else(|| { + let fn_like = hir_map::blocks::FnLikeNode::from_node(node).unwrap_or_else(|| { bug!("asyncness: expected fn-like node but got `{:?}`", def_id); }); diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs index e58c912960817..3ade9661917a2 100644 --- a/src/librustc/ty/print/mod.rs +++ b/src/librustc/ty/print/mod.rs @@ -1,9 +1,9 @@ -use crate::hir::def_id::{CrateNum, DefId}; 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}; // `pretty` is a separate module only for organization. mod pretty; diff --git a/src/librustc/ty/print/obsolete.rs b/src/librustc/ty/print/obsolete.rs index 7c3579d59205e..618c23ecc6e8a 100644 --- a/src/librustc/ty/print/obsolete.rs +++ b/src/librustc/ty/print/obsolete.rs @@ -5,10 +5,11 @@ //! Note: A lot of this could looks very similar to what's already in `ty::print`. //! FIXME(eddyb) implement a custom `PrettyPrinter` for this. -use rustc::hir::def_id::DefId; +use rustc::bug; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Const, Instance, Ty, TyCtxt}; -use rustc::{bug, hir}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use std::fmt::Write; use std::iter; diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 8dafe407ed9c2..b3fb455feb5da 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -1,6 +1,3 @@ -use crate::hir; -use crate::hir::def::{DefKind, Namespace}; -use crate::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use crate::hir::map::{DefPathData, DisambiguatedDefPathData}; use crate::middle::cstore::{ExternCrate, ExternCrateSource}; use crate::middle::region; @@ -8,6 +5,9 @@ use crate::mir::interpret::{sign_extend, truncate, ConstValue, 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; diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 5af0e78b04616..c77cf8c41be9a 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -1,12 +1,12 @@ use crate::dep_graph::SerializedDepNodeIndex; use crate::dep_graph::{DepKind, DepNode}; -use crate::hir::def_id::{CrateNum, DefId}; use crate::ty::query::plumbing::CycleError; use crate::ty::query::queries; use crate::ty::query::QueryCache; use crate::ty::query::{Query, QueryName}; use crate::ty::TyCtxt; use rustc_data_structures::profiling::ProfileCategory; +use rustc_hir::def_id::{CrateNum, DefId}; use crate::ich::StableHashingContext; use rustc_data_structures::fingerprint::Fingerprint; diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index 3cf0a07b29df6..8a713e3b6a096 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -1,13 +1,12 @@ //! Defines the set of legal keys that can be used in queries. -use crate::hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE}; use crate::infer::canonical::Canonical; use crate::mir; use crate::traits; use crate::ty::fast_reject::SimplifiedType; use crate::ty::subst::SubstsRef; use crate::ty::{self, Ty, TyCtxt}; - +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE}; use rustc_span::symbol::Symbol; use rustc_span::{Span, DUMMY_SP}; diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 0ec3874e6a117..b163d23e2394b 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -1,8 +1,5 @@ use crate::dep_graph::{self, DepNode}; -use crate::hir::def::DefKind; -use crate::hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex}; use crate::hir::exports::Export; -use crate::hir::{self, HirIdSet, ItemLocalId, TraitCandidate}; use crate::infer::canonical::{self, Canonical}; use crate::lint; use crate::middle::codegen_fn_attrs::CodegenFnAttrs; @@ -38,13 +35,16 @@ use crate::ty::subst::SubstsRef; use crate::ty::util::NeedsDrop; use crate::ty::{self, AdtSizedConstraint, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt}; use crate::util::common::ErrorReported; -use rustc_data_structures::profiling::ProfileCategory::*; - use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; +use rustc_data_structures::profiling::ProfileCategory::*; use rustc_data_structures::stable_hasher::StableVec; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex}; +use rustc_hir::{HirIdSet, ItemLocalId, TraitCandidate}; use rustc_index::vec::IndexVec; use rustc_target::spec::PanicStrategy; diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 6758aedfabc14..d01927b91b954 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -1,6 +1,4 @@ use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex}; -use crate::hir; -use crate::hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE}; use crate::hir::map::definitions::DefPathHash; use crate::ich::{CachingSourceMapView, Fingerprint}; use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState}; @@ -9,11 +7,12 @@ use crate::session::{CrateDisambiguator, Session}; use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder}; use crate::ty::context::TyCtxt; use crate::ty::{self, Ty}; - use errors::Diagnostic; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once}; use rustc_data_structures::thin_vec::ThinVec; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE}; use rustc_index::vec::{Idx, IndexVec}; use rustc_serialize::{ opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder, diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 120f05ba7d974..9472281b56fec 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -4,13 +4,13 @@ //! types or regions but can be other things. Examples of type relations are //! subtyping, type equality, etc. -use crate::hir as ast; -use crate::hir::def_id::DefId; use crate::mir::interpret::{get_slice_bytes, ConstValue}; use crate::traits; use crate::ty::error::{ExpectedFound, TypeError}; use crate::ty::subst::{GenericArg, GenericArgKind, SubstsRef}; use crate::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc_hir as ast; +use rustc_hir::def_id::DefId; use rustc_target::spec::abi; use std::iter; use std::rc::Rc; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index c92128a1467a5..d87296c03dd2f 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -2,17 +2,16 @@ //! traits for various types in the Rust compiler. Most are written by //! hand, though we've recently added some macros and proc-macros to help with the tedium. -use crate::hir::def::Namespace; -use crate::hir::def_id::CRATE_DEF_INDEX; use crate::mir::interpret; use crate::mir::ProjectionKind; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::print::{FmtPrinter, Printer}; use crate::ty::{self, InferConst, Lift, Ty, TyCtxt}; - +use rustc_hir::def::Namespace; +use rustc_hir::def_id::CRATE_DEF_INDEX; use rustc_index::vec::{Idx, IndexVec}; -use smallvec::SmallVec; +use smallvec::SmallVec; use std::fmt; use std::rc::Rc; use std::sync::Arc; @@ -275,12 +274,12 @@ CloneTypeFoldableAndLiftImpls! { ::syntax::ast::FloatTy, ::syntax::ast::NodeId, ::rustc_span::symbol::Symbol, - crate::hir::def::Res, - crate::hir::def_id::DefId, - crate::hir::InlineAsmInner, - crate::hir::MatchSource, - crate::hir::Mutability, - crate::hir::Unsafety, + ::rustc_hir::def::Res, + ::rustc_hir::def_id::DefId, + ::rustc_hir::InlineAsmInner, + ::rustc_hir::MatchSource, + ::rustc_hir::Mutability, + ::rustc_hir::Unsafety, ::rustc_target::spec::abi::Abi, crate::mir::Local, crate::mir::Promoted, diff --git a/src/librustc/ty/structural_match.rs b/src/librustc/ty/structural_match.rs index 13cb5fd1f38ce..b2c3c23b4e3bd 100644 --- a/src/librustc/ty/structural_match.rs +++ b/src/librustc/ty/structural_match.rs @@ -1,15 +1,13 @@ -use crate::hir; +use crate::ty::fold::{TypeFoldable, TypeVisitor}; +use crate::ty::{self, AdtDef, Ty, TyCtxt}; + use rustc::infer::InferCtxt; use rustc::traits::ObligationCause; use rustc::traits::{self, ConstPatternStructural, TraitEngine}; - use rustc_data_structures::fx::FxHashSet; - +use rustc_hir as hir; use rustc_span::Span; -use crate::ty::fold::{TypeFoldable, TypeVisitor}; -use crate::ty::{self, AdtDef, Ty, TyCtxt}; - #[derive(Debug)] pub enum NonStructuralMatchTy<'tcx> { Adt(&'tcx AdtDef), diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 346622530bd5a..aeda2eb1a15c0 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -5,8 +5,6 @@ use self::InferTy::*; use self::TyKind::*; -use crate::hir; -use crate::hir::def_id::DefId; use crate::infer::canonical::Canonical; use crate::middle::region; use crate::mir::interpret::ConstValue; @@ -16,6 +14,8 @@ use crate::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, Substs use crate::ty::{self, AdtDef, DefIdTree, Discr, Ty, TyCtxt, TypeFlags, TypeFoldable}; use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS}; use crate::util::captures::Captures; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use polonius_engine::Atom; use rustc_index::vec::Idx; diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 0167fae0ce118..a005581283550 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -1,11 +1,11 @@ // Type substitutions. -use crate::hir::def_id::DefId; use crate::infer::canonical::Canonical; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::sty::{ClosureSubsts, GeneratorSubsts}; use crate::ty::{self, Lift, List, ParamConst, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; use rustc_macros::HashStable; use rustc_serialize::{self, Decodable, Decoder, Encodable, Encoder}; use rustc_span::{Span, DUMMY_SP}; diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 422d1b1173792..0cf1c397648ed 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -1,11 +1,11 @@ -use crate::hir; -use crate::hir::def_id::DefId; 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::DefId; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 15fae10236dbc..e0f4f2616017d 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -1,8 +1,5 @@ //! Miscellaneous type-system utilities that are too small to deserve their own modules. -use crate::hir; -use crate::hir::def::DefKind; -use crate::hir::def_id::DefId; use crate::hir::map::DefPathData; use crate::ich::NodeIdHashingMode; use crate::middle::lang_items; @@ -14,6 +11,9 @@ use crate::ty::subst::{GenericArgKind, InternalSubsts, Subst, SubstsRef}; use crate::ty::TyKind::*; use crate::ty::{self, DefIdTree, GenericParamDefKind, Ty, TyCtxt, TypeFoldable}; use crate::util::common::ErrorReported; +use rustc_hir as hir; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::DefId; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 4969e7211cecd..60f5973339129 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -1,10 +1,10 @@ -use crate::hir; -use crate::hir::def_id::DefId; use crate::infer::InferCtxt; use crate::middle::lang_items; use crate::traits::{self, AssocTypeBoundData}; use crate::ty::subst::SubstsRef; use crate::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; use std::iter::once; diff --git a/src/librustc_ast_lowering/Cargo.toml b/src/librustc_ast_lowering/Cargo.toml index 76980dfa31db4..408e9a75d93dd 100644 --- a/src/librustc_ast_lowering/Cargo.toml +++ b/src/librustc_ast_lowering/Cargo.toml @@ -12,6 +12,7 @@ doctest = false [dependencies] log = { version = "0.4", features = ["release_max_level_info", "std"] } rustc = { path = "../librustc" } +rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 591e869193d83..6c8b8b0505716 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -1,10 +1,10 @@ use super::{ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs}; use rustc::bug; -use rustc::hir; -use rustc::hir::def::Res; use rustc_data_structures::thin_vec::ThinVec; use rustc_error_codes::*; +use rustc_hir as hir; +use rustc_hir::def::Res; use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned}; use rustc_span::symbol::{sym, Symbol}; use syntax::ast::*; @@ -207,9 +207,9 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_unop(&mut self, u: UnOp) -> hir::UnOp { match u { - UnOp::Deref => hir::UnDeref, - UnOp::Not => hir::UnNot, - UnOp::Neg => hir::UnNeg, + UnOp::Deref => hir::UnOp::UnDeref, + UnOp::Not => hir::UnOp::UnNot, + UnOp::Neg => hir::UnOp::UnNeg, } } @@ -1374,7 +1374,7 @@ impl<'hir> LoweringContext<'_, 'hir> { stmts: &[], expr: Some(expr), hir_id, - rules: hir::UnsafeBlock(hir::CompilerGenerated), + rules: hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::CompilerGenerated), span, targeted_by_break: false, }), diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs index 7e7e2d1e10892..2515ca9d9466a 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -3,10 +3,10 @@ use super::{ImplTraitContext, ImplTraitPosition, ImplTraitTypeIdVisitor}; use rustc::arena::Arena; use rustc::bug; -use rustc::hir; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::DefId; use rustc_error_codes::*; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::DefId; use rustc_session::node_id::NodeMap; use rustc_span::source_map::{respan, DesugaringKind}; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 5694bedb19937..bc3dfecd4a675 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -36,15 +36,11 @@ use rustc::arena::Arena; use rustc::dep_graph::DepGraph; -use rustc::hir::def::{DefKind, Namespace, PartialRes, PerNS, Res}; -use rustc::hir::def_id::{DefId, DefIdMap, DefIndex, CRATE_DEF_INDEX}; +use rustc::hir::intravisit; use rustc::hir::map::{DefKey, DefPathData, Definitions}; -use rustc::hir::{self, ConstArg, GenericArg, ParamName}; use rustc::lint; use rustc::lint::builtin::{self, ELIDED_LIFETIMES_IN_PATHS}; use rustc::middle::cstore::CrateStore; -use rustc::session::config::nightly_options; -use rustc::session::Session; use rustc::util::captures::Captures; use rustc::util::common::FN_OUTPUT_NAME; use rustc::{bug, span_bug}; @@ -52,8 +48,14 @@ use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; use rustc_error_codes::*; use rustc_errors::Applicability; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res}; +use rustc_hir::def_id::{DefId, DefIdMap, DefIndex, CRATE_DEF_INDEX}; +use rustc_hir::{ConstArg, GenericArg, ParamName}; use rustc_index::vec::IndexVec; +use rustc_session::config::nightly_options; use rustc_session::node_id::NodeMap; +use rustc_session::Session; use rustc_span::hygiene::ExpnId; use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind, Spanned}; use rustc_span::symbol::{kw, sym, Symbol}; @@ -1482,11 +1484,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { output_lifetime_params: Vec>, } - impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> { - fn nested_visit_map<'this>( - &'this mut self, - ) -> hir::intravisit::NestedVisitorMap<'this, 'v> { - hir::intravisit::NestedVisitorMap::None + impl<'r, 'a, 'v, 'hir> intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> { + fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'v> { + intravisit::NestedVisitorMap::None } fn visit_generic_args(&mut self, span: Span, parameters: &'v hir::GenericArgs<'v>) { @@ -1494,10 +1494,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { if parameters.parenthesized { let old_collect_elided_lifetimes = self.collect_elided_lifetimes; self.collect_elided_lifetimes = false; - hir::intravisit::walk_generic_args(self, span, parameters); + intravisit::walk_generic_args(self, span, parameters); self.collect_elided_lifetimes = old_collect_elided_lifetimes; } else { - hir::intravisit::walk_generic_args(self, span, parameters); + intravisit::walk_generic_args(self, span, parameters); } } @@ -1510,12 +1510,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // Record the "stack height" of `for<'a>` lifetime bindings // to be able to later fully undo their introduction. let old_len = self.currently_bound_lifetimes.len(); - hir::intravisit::walk_ty(self, t); + intravisit::walk_ty(self, t); self.currently_bound_lifetimes.truncate(old_len); self.collect_elided_lifetimes = old_collect_elided_lifetimes; } else { - hir::intravisit::walk_ty(self, t) + intravisit::walk_ty(self, t) } } @@ -1527,7 +1527,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // Record the "stack height" of `for<'a>` lifetime bindings // to be able to later fully undo their introduction. let old_len = self.currently_bound_lifetimes.len(); - hir::intravisit::walk_poly_trait_ref(self, trait_ref, modifier); + intravisit::walk_poly_trait_ref(self, trait_ref, modifier); self.currently_bound_lifetimes.truncate(old_len); } @@ -1540,7 +1540,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.currently_bound_lifetimes.push(lt_name); } - hir::intravisit::walk_generic_param(self, param); + intravisit::walk_generic_param(self, param); } fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { @@ -1621,7 +1621,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { }; for bound in bounds { - hir::intravisit::walk_param_bound(&mut lifetime_collector, &bound); + intravisit::walk_param_bound(&mut lifetime_collector, &bound); } let ImplTraitLifetimeCollector { output_lifetimes, output_lifetime_params, .. } = @@ -2144,12 +2144,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } else { match decl.output { FunctionRetTy::Ty(ref ty) => match in_band_ty_params { - Some((def_id, _)) if impl_trait_return_allow => { - hir::Return(self.lower_ty(ty, ImplTraitContext::OpaqueTy(Some(def_id)))) - } - _ => hir::Return(self.lower_ty(ty, ImplTraitContext::disallowed())), + Some((def_id, _)) if impl_trait_return_allow => hir::FunctionRetTy::Return( + self.lower_ty(ty, ImplTraitContext::OpaqueTy(Some(def_id))), + ), + _ => hir::FunctionRetTy::Return( + self.lower_ty(ty, ImplTraitContext::disallowed()), + ), }, - FunctionRetTy::Default(span) => hir::DefaultReturn(span), + FunctionRetTy::Default(span) => hir::FunctionRetTy::DefaultReturn(span), } }; @@ -2940,8 +2942,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_block_check_mode(&mut self, b: &BlockCheckMode) -> hir::BlockCheckMode { match *b { - BlockCheckMode::Default => hir::DefaultBlock, - BlockCheckMode::Unsafe(u) => hir::UnsafeBlock(self.lower_unsafe_source(u)), + BlockCheckMode::Default => hir::BlockCheckMode::DefaultBlock, + BlockCheckMode::Unsafe(u) => { + hir::BlockCheckMode::UnsafeBlock(self.lower_unsafe_source(u)) + } } } @@ -2956,8 +2960,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { fn lower_unsafe_source(&mut self, u: UnsafeSource) -> hir::UnsafeSource { match u { - CompilerGenerated => hir::CompilerGenerated, - UserProvided => hir::UserProvided, + CompilerGenerated => hir::UnsafeSource::CompilerGenerated, + UserProvided => hir::UnsafeSource::UserProvided, } } @@ -3004,7 +3008,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { stmts, expr, hir_id: self.next_id(), - rules: hir::DefaultBlock, + rules: hir::BlockCheckMode::DefaultBlock, span, targeted_by_break: false, }; diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index ec4967efb5615..2d9232bc19255 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -23,6 +23,7 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } rustc_feature = { path = "../librustc_feature" } rustc_fs_util = { path = "../librustc_fs_util" } +rustc_hir = { path = "../librustc_hir" } rustc_incremental = { path = "../librustc_incremental" } rustc_index = { path = "../librustc_index" } rustc_llvm = { path = "../librustc_llvm" } diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 14e2009912fca..e816bdeb1c92c 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -4,10 +4,10 @@ use crate::llvm; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use rustc::hir; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::*; +use rustc_hir as hir; use rustc_span::Span; use libc::{c_char, c_uint}; diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index a7826282314eb..4ed4e8ac6efab 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -2,7 +2,6 @@ use std::ffi::CString; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::session::config::{OptLevel, Sanitizer}; use rustc::session::Session; @@ -13,6 +12,7 @@ use rustc_codegen_ssa::traits::*; use rustc_data_structures::const_cstr; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::small_c_str::SmallCStr; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_target::abi::call::Conv; use rustc_target::spec::PanicStrategy; diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index ca95a3163499c..3134ae5922c9a 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -8,7 +8,6 @@ use crate::{LlvmCodegenBackend, ModuleLlvm}; use log::{debug, info}; use rustc::bug; use rustc::dep_graph::WorkProduct; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::middle::exported_symbols::SymbolExportLevel; use rustc::session::config::{self, Lto}; use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule, ThinShared}; @@ -18,6 +17,7 @@ use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, RLIB_BYTECODE_EXTENSION}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{FatalError, Handler}; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_session::cgu_reuse_tracker::CguReuse; use std::ffi::{CStr, CString}; diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index fa4d8a8d847f6..afdfb36c2a9f6 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -12,7 +12,6 @@ use crate::LlvmCodegenBackend; use crate::ModuleLlvm; use log::debug; use rustc::bug; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::config::{self, Lto, OutputType, Passes, Sanitizer, SwitchWithOptPath}; use rustc::session::Session; use rustc::ty::TyCtxt; @@ -22,6 +21,7 @@ use rustc_codegen_ssa::{CompiledModule, ModuleCodegen, RLIB_BYTECODE_EXTENSION}; use rustc_data_structures::small_c_str::SmallCStr; use rustc_errors::{FatalError, Handler}; use rustc_fs_util::{link_or_copy, path_to_c_string}; +use rustc_hir::def_id::LOCAL_CRATE; use libc::{c_char, c_int, c_uint, c_void, size_t}; use std::ffi::CString; diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 8bf238379dd5c..357b0b6c45151 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -7,7 +7,6 @@ use crate::type_of::LayoutLlvmExt; use crate::value::Value; use libc::{c_char, c_uint}; use log::debug; -use rustc::hir::def_id::DefId; use rustc::session::config; use rustc::ty::layout::{self, Align, Size, TyLayout}; use rustc::ty::{self, Ty, TyCtxt}; @@ -19,6 +18,7 @@ use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::MemFlags; use rustc_data_structures::const_cstr; use rustc_data_structures::small_c_str::SmallCStr; +use rustc_hir::def_id::DefId; use rustc_target::spec::{HasTargetSpec, Target}; use std::borrow::Cow; use std::ffi::CStr; diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 4b4fbd0e1ad53..88850e19d8f9f 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -7,8 +7,6 @@ use crate::type_of::LayoutLlvmExt; use crate::value::Value; use libc::c_uint; use log::debug; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, Node}; use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc::mir::interpret::{read_target_uint, Allocation, ConstValue, ErrorHandled, Pointer}; use rustc::mir::mono::MonoItem; @@ -16,6 +14,9 @@ use rustc::ty::layout::{self, Align, LayoutOf, Size}; use rustc::ty::{self, Instance, Ty}; use rustc::{bug, span_bug}; use rustc_codegen_ssa::traits::*; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Node; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use rustc_target::abi::HasDataLayout; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 746b76ad1c7d0..f07601ed383fe 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -5,7 +5,6 @@ use crate::llvm; use crate::llvm_util; use crate::value::Value; use rustc::dep_graph::DepGraphSafe; -use rustc::hir; use crate::type_::Type; use rustc_codegen_ssa::traits::*; @@ -24,6 +23,7 @@ use rustc_data_structures::base_n; use rustc_data_structures::const_cstr; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::small_c_str::SmallCStr; +use rustc_hir::Unsafety; use rustc_target::spec::{HasTargetSpec, Target}; use crate::abi::Abi; @@ -415,7 +415,7 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { iter::once(tcx.mk_mut_ptr(tcx.types.u8)), tcx.types.never, false, - hir::Unsafety::Unsafe, + Unsafety::Unsafe, Abi::C, )); diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 88e692cb11747..c2ce35f919778 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -20,8 +20,6 @@ use crate::llvm_util; use crate::value::Value; use log::debug; -use rustc::hir::def::CtorKind; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::ich::NodeIdHashingMode; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::mir::interpret::truncate; @@ -41,6 +39,8 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_fs_util::path_to_c_string; +use rustc_hir::def::CtorKind; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::symbol::{Interner, Symbol}; use rustc_span::{self, FileName, Span}; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 0edfd3457746d..0462dcff42919 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -13,9 +13,9 @@ use crate::llvm; use crate::llvm::debuginfo::{ DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DISPFlags, DIScope, DIType, }; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE}; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::ty::subst::{GenericArgKind, SubstsRef}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE}; use crate::abi::FnAbi; use crate::builder::Builder; diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs index 77b47efd3ddce..582f495207455 100644 --- a/src/librustc_codegen_llvm/debuginfo/namespace.rs +++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs @@ -7,8 +7,8 @@ use rustc::ty::{self, Instance}; use crate::common::CodegenCx; use crate::llvm; use crate::llvm::debuginfo::DIScope; -use rustc::hir::def_id::DefId; use rustc::hir::map::DefPathData; +use rustc_hir::def_id::DefId; use rustc_data_structures::small_c_str::SmallCStr; diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs index 53497e396cd3e..4e17387e057f9 100644 --- a/src/librustc_codegen_llvm/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -3,8 +3,8 @@ use super::namespace::item_namespace; use super::CrateDebugContext; -use rustc::hir::def_id::DefId; use rustc::ty::DefIdTree; +use rustc_hir::def_id::DefId; use crate::common::CodegenCx; use crate::llvm; diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 0e121df1d257e..fea769dbba61d 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -7,7 +7,6 @@ use crate::type_::Type; use crate::type_of::LayoutLlvmExt; use crate::va_arg::emit_va_arg; use crate::value::Value; -use rustc::hir; use rustc::ty::layout::{self, FnAbiExt, HasTyCtxt, LayoutOf, Primitive}; use rustc::ty::{self, Ty}; use rustc::{bug, span_bug}; @@ -17,6 +16,7 @@ use rustc_codegen_ssa::glue; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::MemFlags; +use rustc_hir as hir; use rustc_target::abi::HasDataLayout; use syntax::ast; diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index e0a946a38e4d0..c7b5c5e3db6a9 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -5,11 +5,11 @@ use crate::context::CodegenCx; use crate::llvm; use crate::type_of::LayoutLlvmExt; use log::debug; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty::layout::{FnAbiExt, LayoutOf}; use rustc::ty::{Instance, TypeFoldable}; use rustc_codegen_ssa::traits::*; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; pub use rustc::mir::mono::MonoItem; diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 7eb1ae22397fb..eb192b27405e9 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -28,6 +28,7 @@ rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_data_structures = { path = "../librustc_data_structures"} rustc_errors = { path = "../librustc_errors" } rustc_fs_util = { path = "../librustc_fs_util" } +rustc_hir = { path = "../librustc_hir" } rustc_incremental = { path = "../librustc_incremental" } rustc_index = { path = "../librustc_index" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 2151c0580421f..a53402ebb5c7d 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1,4 +1,3 @@ -use rustc::hir::def_id::CrateNum; use rustc::middle::cstore::{EncodedMetadata, LibSource, NativeLibrary, NativeLibraryKind}; use rustc::middle::dependency_format::Linkage; use rustc::session::config::{ @@ -10,6 +9,7 @@ use rustc::session::search_paths::PathKind; use rustc::session::{filesearch, Session}; use rustc_data_structures::fx::FxHashSet; use rustc_fs_util::fix_windows_verbatim_for_gcc; +use rustc_hir::def_id::CrateNum; use rustc_span::symbol::Symbol; use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel}; diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index fb9ba2a1558f3..11f5d3007e6b4 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -9,11 +9,11 @@ use std::io::prelude::*; use std::io::{self, BufWriter}; use std::path::{Path, PathBuf}; -use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::middle::dependency_format::Linkage; use rustc::session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel}; use rustc::session::Session; use rustc::ty::TyCtxt; +use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_serialize::{json, Encoder}; use rustc_span::symbol::Symbol; use rustc_target::spec::{LinkerFlavor, LldFlavor}; diff --git a/src/librustc_codegen_ssa/back/rpath.rs b/src/librustc_codegen_ssa/back/rpath.rs index b09fd832831c0..9d19cc25a32bc 100644 --- a/src/librustc_codegen_ssa/back/rpath.rs +++ b/src/librustc_codegen_ssa/back/rpath.rs @@ -3,8 +3,8 @@ use std::env; use std::fs; use std::path::{Path, PathBuf}; -use rustc::hir::def_id::CrateNum; use rustc::middle::cstore::LibSource; +use rustc_hir::def_id::CrateNum; pub struct RPathConfig<'a> { pub used_crates: &'a [(CrateNum, LibSource)], diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 0f54557eaed2d..edd0fa5042707 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -1,9 +1,6 @@ use std::collections::hash_map::Entry::*; use std::sync::Arc; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc::hir::Node; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::middle::exported_symbols::{metadata_symbol_name, ExportedSymbol, SymbolExportLevel}; use rustc::session::config; @@ -13,6 +10,9 @@ use rustc::ty::Instance; use rustc::ty::{SymbolName, TyCtxt}; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::Node; use rustc_index::vec::IndexVec; use syntax::expand::allocator::ALLOCATOR_METHODS; diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 44ed297ea8396..075374fd8a951 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -11,7 +11,6 @@ use crate::{ use crate::traits::*; use jobserver::{Acquired, Client}; use rustc::dep_graph::{WorkProduct, WorkProductFileKind, WorkProductId}; -use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::middle::cstore::EncodedMetadata; use rustc::session::config::{ self, Lto, OutputFilenames, OutputType, Passes, Sanitizer, SwitchWithOptPath, @@ -26,6 +25,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::emitter::Emitter; use rustc_errors::{DiagnosticId, FatalError, Handler, Level}; use rustc_fs_util::link_or_copy; +use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_incremental::{ copy_cgu_workproducts_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess, }; diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index 6750b7e65ba9e..ededb36c7127f 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -25,8 +25,6 @@ use crate::mir::place::PlaceRef; use crate::traits::*; use crate::{CachedModuleCodegen, CrateInfo, MemFlags, ModuleCodegen, ModuleKind}; -use rustc::hir; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::middle::codegen_fn_attrs::CodegenFnAttrs; use rustc::middle::cstore::EncodedMetadata; use rustc::middle::cstore::{self, LinkagePreference}; @@ -42,6 +40,8 @@ use rustc::ty::{self, Instance, Ty, TyCtxt}; use rustc_codegen_utils::{check_for_rustc_errors_attr, symbol_names_test}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::profiling::print_time_passes_entry; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_index::vec::Idx; use rustc_session::cgu_reuse_tracker::CguReuse; use rustc_span::Span; diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index e0505daed8a62..299a6d95272f7 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -6,11 +6,11 @@ use rustc_span::Span; use crate::base; use crate::traits::*; -use rustc::hir::def_id::DefId; use rustc::middle::lang_items::LangItem; +use rustc_hir::def_id::DefId; use crate::traits::BuilderMethods; -use rustc::hir; +use rustc_hir as hir; use rustc_error_codes::*; diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index 4d18f49ebf758..8dd35208bf69a 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -1,8 +1,9 @@ // Type Names for Debug Info. -use rustc::hir::{self, def_id::DefId}; use rustc::ty::{self, subst::SubstsRef, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; // Compute the name of the type as it should be stored in debuginfo. Does not do // any caching, i.e., calling the function twice with the same type will also do diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index fd31361d67950..b476fd952004b 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -25,7 +25,6 @@ extern crate rustc; extern crate syntax; use rustc::dep_graph::WorkProduct; -use rustc::hir::def_id::CrateNum; use rustc::middle::cstore::{CrateSource, LibSource, NativeLibrary}; use rustc::middle::dependency_format::Dependencies; use rustc::middle::lang_items::LangItem; @@ -34,6 +33,7 @@ use rustc::ty::query::Providers; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; +use rustc_hir::def_id::CrateNum; use rustc_span::symbol::Symbol; use std::path::{Path, PathBuf}; diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index 4b4a2f4b26d42..6c17a01eb9133 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -1,9 +1,9 @@ use crate::traits::*; -use rustc::hir::def_id::CrateNum; use rustc::mir; use rustc::session::config::DebugInfo; use rustc::ty::layout::{LayoutOf, Size}; use rustc::ty::TyCtxt; +use rustc_hir::def_id::CrateNum; use rustc_index::vec::IndexVec; use rustc_span::symbol::kw; diff --git a/src/librustc_codegen_ssa/mono_item.rs b/src/librustc_codegen_ssa/mono_item.rs index c57da413fff8a..ae211cad62de4 100644 --- a/src/librustc_codegen_ssa/mono_item.rs +++ b/src/librustc_codegen_ssa/mono_item.rs @@ -1,8 +1,8 @@ use crate::base; use crate::traits::*; -use rustc::hir; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty::layout::HasTyCtxt; +use rustc_hir as hir; use rustc::mir::mono::MonoItem; diff --git a/src/librustc_codegen_ssa/traits/asm.rs b/src/librustc_codegen_ssa/traits/asm.rs index 6af63edbe79ed..d31b063232c85 100644 --- a/src/librustc_codegen_ssa/traits/asm.rs +++ b/src/librustc_codegen_ssa/traits/asm.rs @@ -1,6 +1,6 @@ use super::BackendTypes; use crate::mir::place::PlaceRef; -use rustc::hir::{GlobalAsm, InlineAsmInner}; +use rustc_hir::{GlobalAsm, InlineAsmInner}; use rustc_span::Span; pub trait AsmBuilderMethods<'tcx>: BackendTypes { diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index c2e8bad4b2dbe..d2784f5b860f7 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -1,9 +1,9 @@ use super::BackendTypes; use crate::mir::debuginfo::{FunctionDebugContext, VariableKind}; -use rustc::hir::def_id::CrateNum; use rustc::mir; use rustc::ty::layout::Size; use rustc::ty::{Instance, Ty}; +use rustc_hir::def_id::CrateNum; use rustc_span::{SourceFile, Span}; use rustc_target::abi::call::FnAbi; use syntax::ast::Name; diff --git a/src/librustc_codegen_ssa/traits/declare.rs b/src/librustc_codegen_ssa/traits/declare.rs index 1dd2c74dd4fa2..c2ab5f50c6f7e 100644 --- a/src/librustc_codegen_ssa/traits/declare.rs +++ b/src/librustc_codegen_ssa/traits/declare.rs @@ -1,7 +1,7 @@ use super::BackendTypes; -use rustc::hir::def_id::DefId; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty::{Instance, Ty}; +use rustc_hir::def_id::DefId; use rustc_target::abi::call::FnAbi; pub trait DeclareMethods<'tcx>: BackendTypes { diff --git a/src/librustc_codegen_ssa/traits/statics.rs b/src/librustc_codegen_ssa/traits/statics.rs index 5c108f9fa6cc5..40c9dde98c628 100644 --- a/src/librustc_codegen_ssa/traits/statics.rs +++ b/src/librustc_codegen_ssa/traits/statics.rs @@ -1,6 +1,6 @@ use super::BackendTypes; -use rustc::hir::def_id::DefId; use rustc::ty::layout::Align; +use rustc_hir::def_id::DefId; pub trait StaticMethods: BackendTypes { fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value; diff --git a/src/librustc_codegen_utils/Cargo.toml b/src/librustc_codegen_utils/Cargo.toml index 404e556cd524e..8361a19ade9bc 100644 --- a/src/librustc_codegen_utils/Cargo.toml +++ b/src/librustc_codegen_utils/Cargo.toml @@ -17,6 +17,7 @@ rustc-demangle = "0.1.16" syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } rustc = { path = "../librustc" } +rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_metadata = { path = "../librustc_metadata" } diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index 399db7aafc76f..6b802bf530e86 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -15,9 +15,9 @@ #[macro_use] extern crate rustc; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_span::symbol::sym; pub mod codegen_backend; diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index e479573038b73..450dcd3b6041c 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -87,13 +87,13 @@ //! virtually impossible. Thus, symbol hash generation exclusively relies on //! DefPaths which are much more robust in the face of changes to the code base. -use rustc::hir::def_id::LOCAL_CRATE; -use rustc::hir::Node; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::mir::mono::{InstantiationMode, MonoItem}; use rustc::session::config::SymbolManglingVersion; use rustc::ty::query::Providers; use rustc::ty::{self, Instance, TyCtxt}; +use rustc_hir::def_id::LOCAL_CRATE; +use rustc_hir::Node; use rustc_span::symbol::Symbol; diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index 29869a1dae4f3..4f5b9ce03fc3f 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -1,4 +1,3 @@ -use rustc::hir::def_id::CrateNum; use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::ich::NodeIdHashingMode; use rustc::mir::interpret::{ConstValue, Scalar}; @@ -7,6 +6,7 @@ use rustc::ty::subst::{GenericArg, GenericArgKind}; use rustc::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; use rustc::util::common::record_time; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def_id::CrateNum; use log::debug; diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index 045d06a2e1de0..ff4e128e19090 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -1,11 +1,11 @@ -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId}; use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::ty::print::{Print, Printer}; use rustc::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::base_n; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId}; use rustc_target::spec::abi::Abi; use syntax::ast::{FloatTy, IntTy, UintTy}; diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 0a76093a9a9fd..8f2f2628e7b7f 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -4,8 +4,8 @@ //! def-path. This is used for unit testing the code that generates //! paths etc in all kinds of annoying scenarios. -use rustc::hir; use rustc::ty::{Instance, TyCtxt}; +use rustc_hir as hir; use rustc_span::symbol::{sym, Symbol}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 99436f427cb00..ed742ed1ca0a3 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -20,6 +20,7 @@ rustc_lint = { path = "../librustc_lint" } rustc_data_structures = { path = "../librustc_data_structures" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_feature = { path = "../librustc_feature" } +rustc_hir = { path = "../librustc_hir" } rustc_metadata = { path = "../librustc_metadata" } rustc_mir = { path = "../librustc_mir" } rustc_parse = { path = "../librustc_parse" } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 379e9bdfa878a..dece0a55edd18 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -25,7 +25,6 @@ pub extern crate rustc_plugin_impl as plugin; //use rustc_resolve as resolve; use errors::{registry::Registry, PResult}; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::lint; use rustc::lint::Lint; use rustc::middle::cstore::MetadataLoader; @@ -39,6 +38,7 @@ use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::profiling::print_time_passes_entry; use rustc_data_structures::sync::SeqCst; use rustc_feature::{find_gated_cfg, UnstableFeatures}; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_interface::util::get_builtin_codegen_backend; use rustc_interface::{interface, Queries}; use rustc_metadata::locator; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 84fa5fb786bfb..8804a05b596ee 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -1,13 +1,13 @@ //! The various pretty-printing routines. -use rustc::hir; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::hir::map as hir_map; -use rustc::hir::print as pprust_hir; use rustc::session::config::{Input, PpMode, PpSourceMode}; use rustc::session::Session; use rustc::ty::{self, TyCtxt}; use rustc::util::common::ErrorReported; +use rustc_hir as hir; +use rustc_hir::def_id::LOCAL_CRATE; +use rustc_hir::print as pprust_hir; use rustc_mir::util::{write_mir_graphviz, write_mir_pretty}; use rustc_span::FileName; diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 3e5570847fa5e..09b33a6c83d8d 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -15,6 +15,7 @@ log = "0.4" rand = "0.7" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_hir = { path = "../librustc_hir" } rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 738dfa712311a..64547845e74f1 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -36,12 +36,12 @@ use graphviz as dot; use rustc::dep_graph::debug::{DepNodeFilter, EdgeFilter}; use rustc::dep_graph::{DepGraphQuery, DepKind, DepNode}; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index b6ce12cf90886..70abb38278add 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -21,9 +21,9 @@ //! allows for doing a more fine-grained check to see if pre- or post-lto data //! was re-used. -use rustc::hir::def_id::LOCAL_CRATE; use rustc::mir::mono::CodegenUnitNameBuilder; use rustc::ty::TyCtxt; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_session::cgu_reuse_tracker::*; use rustc_span::symbol::{sym, Symbol}; use std::collections::BTreeSet; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 4d08ccebd696f..40dd4c88a02b2 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -14,15 +14,15 @@ //! the required condition is not met. use rustc::dep_graph::{label_strs, DepNode}; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::Node as HirNode; -use rustc::hir::{ImplItemKind, ItemKind as HirItem, TraitItemKind}; use rustc::ty::TyCtxt; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::Node as HirNode; +use rustc_hir::{ImplItemKind, ItemKind as HirItem, TraitItemKind}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use std::iter::FromIterator; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index cd632c310f0a3..432f79bba030a 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -5,8 +5,7 @@ use crate::util; use log::{info, log_enabled, warn}; use rustc::arena::Arena; use rustc::dep_graph::DepGraph; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc::hir::map; use rustc::lint; use rustc::middle; use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn}; @@ -26,6 +25,7 @@ use rustc_data_structures::sync::{par_iter, Lrc, Once, ParallelIterator, WorkerL use rustc_data_structures::{box_region_allow_access, declare_box_region_type, parallel}; use rustc_errors::PResult; use rustc_expand::base::ExtCtxt; +use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc_incremental; use rustc_mir as mir; use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str}; @@ -433,7 +433,7 @@ pub fn lower_to_hir<'res, 'tcx>( dep_graph: &'res DepGraph, krate: &'res ast::Crate, arena: &'tcx Arena<'tcx>, -) -> Result> { +) -> Result> { // Lower AST to HIR. let hir_forest = sess.time("lowering AST -> HIR", || { let hir_crate = rustc_ast_lowering::lower_crate( @@ -449,7 +449,7 @@ pub fn lower_to_hir<'res, 'tcx>( hir_stats::print_hir_stats(&hir_crate); } - hir::map::Forest::new(hir_crate, &dep_graph) + map::Forest::new(hir_crate, &dep_graph) }); sess.time("early lint checks", || { @@ -676,7 +676,7 @@ pub fn default_provide(providers: &mut ty::query::Providers<'_>) { providers.analysis = analysis; proc_macro_decls::provide(providers); plugin::build::provide(providers); - hir::provide(providers); + rustc::hir::provide(providers); mir::provide(providers); rustc_privacy::provide(providers); typeck::provide(providers); @@ -714,7 +714,7 @@ impl<'tcx> QueryContext<'tcx> { pub fn create_global_ctxt<'tcx>( compiler: &'tcx Compiler, lint_store: Lrc, - hir_forest: &'tcx hir::map::Forest<'tcx>, + hir_forest: &'tcx map::Forest<'tcx>, mut resolver_outputs: ResolverOutputs, outputs: OutputFilenames, crate_name: &str, @@ -727,7 +727,7 @@ pub fn create_global_ctxt<'tcx>( // Construct the HIR map. let hir_map = sess.time("indexing HIR", || { - hir::map::map_crate(sess, &*resolver_outputs.cstore, &hir_forest, defs) + map::map_crate(sess, &*resolver_outputs.cstore, &hir_forest, defs) }); let query_result_on_disk_cache = diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index beb479046a537..9238f88b2b527 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -1,8 +1,8 @@ -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use syntax::attr; diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index c0a75e7efbfe2..2de0e1ecccc83 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -3,8 +3,7 @@ use crate::passes::{self, BoxedResolver, QueryContext}; use rustc::arena::Arena; use rustc::dep_graph::DepGraph; -use rustc::hir; -use rustc::hir::def_id::LOCAL_CRATE; +use rustc::hir::map; use rustc::lint; use rustc::lint::LintStore; use rustc::session::config::{OutputFilenames, OutputType}; @@ -14,6 +13,7 @@ use rustc::ty::{AllArenas, GlobalCtxt, ResolverOutputs}; use rustc::util::common::ErrorReported; use rustc_codegen_utils::codegen_backend::CodegenBackend; use rustc_data_structures::sync::{Lrc, Once, WorkerLocal}; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_incremental::DepGraphFuture; use std::any::Any; use std::cell::{Ref, RefCell, RefMut}; @@ -76,7 +76,7 @@ pub struct Queries<'tcx> { register_plugins: Query<(ast::Crate, Lrc)>, expansion: Query<(ast::Crate, Steal>>, Lrc)>, dep_graph: Query, - lower_to_hir: Query<(&'tcx hir::map::Forest<'tcx>, Steal)>, + lower_to_hir: Query<(&'tcx map::Forest<'tcx>, Steal)>, prepare_outputs: Query, global_ctxt: Query>, ongoing_codegen: Query>, @@ -211,7 +211,7 @@ impl<'tcx> Queries<'tcx> { pub fn lower_to_hir( &'tcx self, - ) -> Result<&Query<(&'tcx hir::map::Forest<'tcx>, Steal)>> { + ) -> Result<&Query<(&'tcx map::Forest<'tcx>, Steal)>> { self.lower_to_hir.compute(|| { let expansion_result = self.expansion()?; let peeked = expansion_result.peek(); diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index a40c5d1697c43..820064cb5b6f8 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -12,6 +12,7 @@ path = "lib.rs" log = "0.4" unicode-security = "0.0.2" rustc = { path = "../librustc" } +rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_lint/array_into_iter.rs b/src/librustc_lint/array_into_iter.rs index 6beedb08db5ec..46202cda16d50 100644 --- a/src/librustc_lint/array_into_iter.rs +++ b/src/librustc_lint/array_into_iter.rs @@ -1,12 +1,8 @@ use crate::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass}; -use rustc::{ - hir, - lint::FutureIncompatibleInfo, - ty::{ - self, - adjustment::{Adjust, Adjustment}, - }, -}; +use rustc::lint::FutureIncompatibleInfo; +use rustc::ty; +use rustc::ty::adjustment::{Adjust, Adjustment}; +use rustc_hir as hir; use rustc_span::symbol::sym; use syntax::errors::Applicability; diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 5e107b2f72d62..59b87afe2160b 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -25,17 +25,17 @@ use std::fmt::Write; use lint::{EarlyContext, EarlyLintPass, LateLintPass, LintPass}; use lint::{LateContext, LintArray, LintContext}; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::DefId; -use rustc::hir::{HirIdSet, Node}; use rustc::lint; use rustc::lint::FutureIncompatibleInfo; use rustc::ty::{self, layout::VariantIdx, Ty, TyCtxt}; - use rustc_data_structures::fx::FxHashSet; use rustc_feature::Stability; use rustc_feature::{deprecated_attributes, AttributeGate, AttributeTemplate, AttributeType}; - +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::{GenericParamKind, PatKind}; +use rustc_hir::{HirIdSet, Node}; use rustc_span::edition::Edition; use rustc_span::source_map::Spanned; use rustc_span::symbol::{kw, sym, Symbol}; @@ -48,8 +48,6 @@ use syntax::ptr::P; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::visit::FnKind; -use rustc::hir::{self, GenericParamKind, PatKind}; - use crate::nonstandard_style::{method_context, MethodLateContext}; use log::debug; diff --git a/src/librustc_lint/late.rs b/src/librustc_lint/late.rs index e66de9cc1bbc7..2e0a201fa98e9 100644 --- a/src/librustc_lint/late.rs +++ b/src/librustc_lint/late.rs @@ -14,16 +14,15 @@ //! upon. As the ast is traversed, this keeps track of the current lint level //! for all lint attributes. -use rustc::hir; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::hir::intravisit as hir_visit; use rustc::hir::intravisit::Visitor; use rustc::lint::LateContext; use rustc::lint::LintPass; use rustc::lint::{LateLintPass, LateLintPassObject}; use rustc::ty::{self, TyCtxt}; - use rustc_data_structures::sync::{join, par_iter, ParallelIterator}; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_span::Span; use std::slice; use syntax::ast; diff --git a/src/librustc_lint/levels.rs b/src/librustc_lint/levels.rs index c148d39c80c51..e060d6b551ca7 100644 --- a/src/librustc_lint/levels.rs +++ b/src/librustc_lint/levels.rs @@ -1,9 +1,9 @@ -use rustc::hir; -use rustc::hir::def_id::{CrateNum, LOCAL_CRATE}; use rustc::hir::intravisit; use rustc::lint::{LintLevelMap, LintLevelSets, LintLevelsBuilder, LintStore}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; use syntax::ast; pub use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintId}; diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 2a3b90f8c93b4..e272c3af46824 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -33,8 +33,6 @@ mod redundant_semicolon; mod types; mod unused; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::lint; use rustc::lint::builtin::{ BARE_TRAIT_OBJECTS, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS, @@ -43,6 +41,8 @@ use rustc::lint::builtin::{ use rustc::lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintPass}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index a97061c50ae45..6df2740bee848 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -1,10 +1,11 @@ use lint::{EarlyContext, LateContext, LintArray, LintContext}; use lint::{EarlyLintPass, LateLintPass, LintPass}; -use rustc::hir::def::{DefKind, Res}; use rustc::hir::intravisit::FnKind; -use rustc::hir::{self, GenericParamKind, PatKind}; use rustc::lint; use rustc::ty; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::{GenericParamKind, PatKind}; use rustc_span::symbol::sym; use rustc_span::{symbol::Ident, BytePos, Span}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 7944c88c7cbd8..f740bdb271619 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -3,14 +3,14 @@ use crate::hir::def_id::DefId; use lint::{LateContext, LintArray, LintContext}; use lint::{LateLintPass, LintPass}; -use rustc::hir; -use rustc::hir::{is_range_literal, ExprKind, Node}; use rustc::lint; use rustc::mir::interpret::{sign_extend, truncate}; use rustc::ty::layout::{self, IntegerExt, LayoutOf, SizeSkeleton, VariantIdx}; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::{is_range_literal, ExprKind, Node}; use rustc_index::vec::Idx; use rustc_span::source_map; use rustc_span::symbol::sym; @@ -376,7 +376,7 @@ fn lint_literal<'a, 'tcx>( impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr<'tcx>) { match e.kind { - hir::ExprKind::Unary(hir::UnNeg, ref expr) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref expr) => { // propagate negation, if the negation itself isn't negated if self.negated_expr_id != e.hir_id { self.negated_expr_id = expr.hir_id; @@ -969,7 +969,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { self.check_type_for_ffi_and_report_errors(input_hir.span, input_ty, false); } - if let hir::Return(ref ret_hir) = decl.output { + if let hir::FunctionRetTy::Return(ref ret_hir) = decl.output { let ret_ty = sig.output(); if !ret_ty.is_unit() { self.check_type_for_ffi_and_report_errors(ret_hir.span, ret_ty, false); diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index db2598d321aca..184651e3ad564 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -1,14 +1,14 @@ use lint::{EarlyContext, LateContext, LintArray, LintContext}; use lint::{EarlyLintPass, LateLintPass, LintPass}; -use rustc::hir; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::DefId; use rustc::lint; use rustc::lint::builtin::UNUSED_ATTRIBUTES; use rustc::ty::adjustment; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; use rustc_feature::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::DefId; use rustc_span::symbol::Symbol; use rustc_span::symbol::{kw, sym}; diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index c8ef9f1edb0ad..d998e82d4890b 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -16,6 +16,7 @@ memmap = "0.7" smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_hir = { path = "../librustc_hir" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } rustc_index = { path = "../librustc_index" } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index f95801d6fb15a..cfd7b76a22279 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -3,8 +3,6 @@ use crate::locator::{CrateLocator, CratePaths}; use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob}; -use rustc::hir::def_id::CrateNum; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::hir::map::Definitions; use rustc::middle::cstore::DepKind; use rustc::middle::cstore::{CrateSource, ExternCrate, ExternCrateSource, MetadataLoaderDyn}; @@ -14,6 +12,8 @@ use rustc::session::{CrateDisambiguator, Session}; use rustc::ty::TyCtxt; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::Lrc; +use rustc_hir::def_id::CrateNum; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_index::vec::IndexVec; use rustc_target::spec::{PanicStrategy, TargetTriple}; diff --git a/src/librustc_metadata/dependency_format.rs b/src/librustc_metadata/dependency_format.rs index f82579aba02ad..3427de19daa80 100644 --- a/src/librustc_metadata/dependency_format.rs +++ b/src/librustc_metadata/dependency_format.rs @@ -53,13 +53,13 @@ use crate::creader::CStore; -use rustc::hir::def_id::CrateNum; use rustc::middle::cstore::LinkagePreference::{self, RequireDynamic, RequireStatic}; use rustc::middle::cstore::{self, DepKind}; use rustc::middle::dependency_format::{Dependencies, DependencyList, Linkage}; use rustc::session::config; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::CrateNum; use rustc_target::spec::PanicStrategy; crate fn calculate(tcx: TyCtxt<'_>) -> Dependencies { diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index a48d7f0ba0f50..fc988ec15cee9 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -1,7 +1,7 @@ -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; crate fn collect(tcx: TyCtxt<'_>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new() }; diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 6649cf09a0735..8d018b9bb94dd 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -1,6 +1,6 @@ -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index bdd9eab71186d..c524d2074f523 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -1,9 +1,9 @@ -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::middle::cstore::{self, NativeLibrary}; use rustc::session::Session; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 1ed6b748d873a..77d143643b59e 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -4,9 +4,6 @@ use crate::rmeta::table::{FixedSizeEncoding, Table}; use crate::rmeta::*; use rustc::dep_graph::{self, DepNodeIndex}; -use rustc::hir; -use rustc::hir::def::{CtorKind, CtorOf, DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::exports::Export; use rustc::hir::map::definitions::DefPathTable; use rustc::hir::map::{DefKey, DefPath, DefPathData, DefPathHash}; @@ -25,6 +22,9 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{AtomicCell, Lock, LockGuard, Lrc, Once}; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_index::vec::{Idx, IndexVec}; use std::io; diff --git a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 5d5fcf4068987..ba3c4e4aff443 100644 --- a/src/librustc_metadata/rmeta/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -4,8 +4,6 @@ use crate::link_args; use crate::native_libs; use crate::rmeta::{self, encoder}; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::exports::Export; use rustc::hir::map::definitions::DefPathTable; use rustc::hir::map::{DefKey, DefPath, DefPathHash}; @@ -17,6 +15,8 @@ use rustc::ty::query::Providers; use rustc::ty::query::QueryConfig; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::svh::Svh; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_parse::parser::emit_unclosed_delims; use rustc_parse::source_file_to_stream; diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index fc7eae1e6c7a1..92bfc51d9d5f0 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -1,10 +1,7 @@ use crate::rmeta::table::FixedSizeEncoding; use crate::rmeta::*; -use rustc::hir::def::CtorKind; -use rustc::hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::map::definitions::DefPathTable; -use rustc::hir::{AnonConst, GenericParamKind}; use rustc::middle::cstore::{EncodedMetadata, ForeignModule, LinkagePreference, NativeLibrary}; use rustc::middle::dependency_format::Linkage; use rustc::middle::exported_symbols::{metadata_symbol_name, ExportedSymbol, SymbolExportLevel}; @@ -15,6 +12,9 @@ use rustc::ty::codec::{self as ty_codec, TyEncoder}; use rustc::ty::layout::VariantIdx; use rustc::ty::{self, SymbolName, Ty, TyCtxt}; use rustc_data_structures::fingerprint::Fingerprint; +use rustc_hir::def::CtorKind; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::{AnonConst, GenericParamKind}; use rustc_index::vec::Idx; use rustc::session::config::{self, CrateType}; @@ -37,8 +37,8 @@ use syntax::expand::is_proc_macro_attr; use rustc::hir::intravisit; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::{self, PatKind}; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; struct EncodeContext<'tcx> { opaque: opaque::Encoder, @@ -951,7 +951,7 @@ impl EncodeContext<'tcx> { self.tcx.dep_graph.with_ignore(|| { let body = self.tcx.hir().body(body_id); self.lazy(body.params.iter().map(|arg| match arg.pat.kind { - PatKind::Binding(_, _, ident, _) => ident.name, + hir::PatKind::Binding(_, _, ident, _) => ident.name, _ => kw::Invalid, })) }) diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 4ef978c21e06d..6309f1c260e1c 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -1,10 +1,8 @@ use decoder::Metadata; use table::{Table, TableBuilder}; -use rustc::hir; -use rustc::hir::def::CtorKind; -use rustc::hir::def_id::{DefId, DefIndex}; use rustc::hir::exports::Export; +use rustc::hir::map; use rustc::middle::cstore::{DepKind, ForeignModule, LinkagePreference, NativeLibrary}; use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel}; use rustc::middle::lang_items; @@ -14,6 +12,9 @@ use rustc::session::CrateDisambiguator; use rustc::ty::{self, ReprOptions, Ty}; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::MetadataRef; +use rustc_hir as hir; +use rustc_hir::def::CtorKind; +use rustc_hir::def_id::{DefId, DefIndex}; use rustc_index::vec::IndexVec; use rustc_serialize::opaque::Encoder; use rustc_span::edition::Edition; @@ -192,7 +193,7 @@ crate struct CrateRoot<'tcx> { native_libraries: Lazy<[NativeLibrary]>, foreign_modules: Lazy<[ForeignModule]>, source_map: Lazy<[rustc_span::SourceFile]>, - def_path_table: Lazy, + def_path_table: Lazy, impls: Lazy<[TraitImpls]>, exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]), interpret_alloc_index: Lazy<[u32]>, diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 3f9e2c025866e..9b6908dbbe789 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -18,13 +18,14 @@ log = "0.4" log_settings = "0.1.1" polonius-engine = "0.11.0" rustc = { path = "../librustc" } -rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } -rustc_index = { path = "../librustc_index" } rustc_errors = { path = "../librustc_errors" } +rustc_hir = { path = "../librustc_hir" } +rustc_index = { path = "../librustc_index" } rustc_lexer = { path = "../librustc_lexer" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../libserialize", package = "serialize" } +rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } rustc_apfloat = { path = "../librustc_apfloat" } diff --git a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs index 61d69f8bd9d7d..7e251560a6c51 100644 --- a/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs @@ -1,6 +1,3 @@ -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::{AsyncGeneratorKind, GeneratorKind}; use rustc::mir::{ self, AggregateKind, BindingForm, BorrowKind, ClearCrossCrate, ConstraintCategory, FakeReadCause, Local, LocalDecl, LocalInfo, LocalKind, Location, Operand, Place, PlaceBase, @@ -10,6 +7,9 @@ use rustc::traits::error_reporting::suggest_constraining_type_param; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{Applicability, DiagnosticBuilder}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::{AsyncGeneratorKind, GeneratorKind}; use rustc_index::vec::Idx; use rustc_span::source_map::DesugaringKind; use rustc_span::Span; @@ -1839,7 +1839,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { if let ty::Ref(argument_region, _, _) = argument.kind { if argument_region == return_region { // Need to use the `rustc::ty` types to compare against the - // `return_region`. Then use the `rustc::hir` type to get only + // `return_region`. Then use the `rustc_hir` type to get only // the lifetime span. if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].kind { // With access to the lifetime, we can get diff --git a/src/librustc_mir/borrow_check/diagnostics/mod.rs b/src/librustc_mir/borrow_check/diagnostics/mod.rs index e006c6ddf19ab..c8a59331f31af 100644 --- a/src/librustc_mir/borrow_check/diagnostics/mod.rs +++ b/src/librustc_mir/borrow_check/diagnostics/mod.rs @@ -1,9 +1,5 @@ //! Borrow checker diagnostics. -use rustc::hir; -use rustc::hir::def::Namespace; -use rustc::hir::def_id::DefId; -use rustc::hir::GeneratorKind; use rustc::mir::{ AggregateKind, Constant, Field, Local, LocalInfo, LocalKind, Location, Operand, Place, PlaceBase, PlaceRef, ProjectionElem, Rvalue, Statement, StatementKind, Static, StaticKind, @@ -13,6 +9,10 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::print::Print; use rustc::ty::{self, DefIdTree, Ty, TyCtxt}; use rustc_errors::DiagnosticBuilder; +use rustc_hir as hir; +use rustc_hir::def::Namespace; +use rustc_hir::def_id::DefId; +use rustc_hir::GeneratorKind; use rustc_span::Span; use super::borrow_set::BorrowData; diff --git a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs index 99fedc8b67d6f..595acec2f74d7 100644 --- a/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/mutability_errors.rs @@ -1,8 +1,8 @@ -use rustc::hir; -use rustc::hir::Node; use rustc::mir::{self, ClearCrossCrate, Local, LocalInfo, Location, ReadOnlyBodyAndCache}; use rustc::mir::{Mutability, Place, PlaceBase, PlaceRef, ProjectionElem}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::Node; use rustc_index::vec::Idx; use rustc_span::symbol::kw; use rustc_span::Span; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs index 8d534b6ec8e8e..0d343e76618b4 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_errors.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_errors.rs @@ -1,6 +1,5 @@ //! Error reporting machinery for lifetime errors. -use rustc::hir::def_id::DefId; use rustc::infer::{ error_reporting::nice_region_error::NiceRegionError, region_constraints::GenericKind, InferCtxt, NLLRegionVariableOrigin, @@ -8,6 +7,7 @@ use rustc::infer::{ use rustc::mir::{Body, ConstraintCategory, Location}; use rustc::ty::{self, RegionVid, Ty}; use rustc_errors::DiagnosticBuilder; +use rustc_hir::def_id::DefId; use rustc_index::vec::IndexVec; use rustc_span::symbol::kw; use rustc_span::Span; diff --git a/src/librustc_mir/borrow_check/diagnostics/region_name.rs b/src/librustc_mir/borrow_check/diagnostics/region_name.rs index d66c38e753ac1..734e3861c62de 100644 --- a/src/librustc_mir/borrow_check/diagnostics/region_name.rs +++ b/src/librustc_mir/borrow_check/diagnostics/region_name.rs @@ -1,12 +1,12 @@ use std::fmt::{self, Display}; -use rustc::hir; -use rustc::hir::def::{DefKind, Res}; use rustc::ty::print::RegionHighlightMode; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, RegionVid, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::DiagnosticBuilder; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; use rustc_span::symbol::kw; use rustc_span::{symbol::Symbol, Span, DUMMY_SP}; diff --git a/src/librustc_mir/borrow_check/member_constraints.rs b/src/librustc_mir/borrow_check/member_constraints.rs index 9f10ddbc2527c..53fa5b1269849 100644 --- a/src/librustc_mir/borrow_check/member_constraints.rs +++ b/src/librustc_mir/borrow_check/member_constraints.rs @@ -1,7 +1,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_hir::def_id::DefId; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::Span; use std::hash::Hash; diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 2c6aa7eb1b16b..fff6f036da082 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1,6 +1,5 @@ //! This query borrow-checks the MIR to (further) ensure it is not broken. -use rustc::hir::{self, def_id::DefId, HirId, Node}; use rustc::infer::{opaque_types, InferCtxt}; use rustc::lint::builtin::MUTABLE_BORROW_RESERVATION_CONFLICT; use rustc::lint::builtin::UNUSED_MUT; @@ -13,14 +12,15 @@ use rustc::mir::{Field, ProjectionElem, Promoted, Rvalue, Statement, StatementKi use rustc::mir::{Terminator, TerminatorKind}; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; - use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::graph::dominators::Dominators; use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder}; +use rustc_hir as hir; +use rustc_hir::{def_id::DefId, HirId, Node}; use rustc_index::bit_set::BitSet; use rustc_index::vec::IndexVec; -use smallvec::SmallVec; +use smallvec::SmallVec; use std::collections::BTreeMap; use std::mem; use std::rc::Rc; diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs index 6f223785601fc..a4c2299b3eaac 100644 --- a/src/librustc_mir/borrow_check/nll.rs +++ b/src/librustc_mir/borrow_check/nll.rs @@ -1,6 +1,5 @@ //! The entry point of the NLL borrow checker. -use rustc::hir::def_id::DefId; use rustc::infer::InferCtxt; use rustc::mir::{ BasicBlock, Body, BodyAndCache, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind, @@ -8,6 +7,7 @@ use rustc::mir::{ }; use rustc::ty::{self, RegionKind, RegionVid}; use rustc_errors::Diagnostic; +use rustc_hir::def_id::DefId; use rustc_index::vec::IndexVec; use rustc_span::symbol::sym; use std::env; diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index fd590467e4610..91ab314e2b910 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -1,8 +1,8 @@ use crate::borrow_check::borrow_set::LocalsStateAtExit; -use rustc::hir; use rustc::mir::ProjectionElem; use rustc::mir::{Body, Mutability, Place, PlaceBase}; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; /// Extension methods for the `Place` type. crate trait PlaceExt<'tcx> { diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index f0d51c96d903c..64103719fe925 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -1,11 +1,11 @@ use crate::borrow_check::ArtificialField; use crate::borrow_check::Overlap; use crate::borrow_check::{AccessDepth, Deep, Shallow}; -use rustc::hir; use rustc::mir::{ Body, BorrowKind, Place, PlaceBase, PlaceElem, PlaceRef, ProjectionElem, StaticKind, }; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; use std::cmp::max; /// When checking if a place conflicts with another place, this enum is used to influence decisions diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index b994bafb0c97f..1e88f696f2315 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -9,9 +9,9 @@ use super::MirBorrowckCtxt; -use rustc::hir; use rustc::mir::{Place, PlaceBase, PlaceRef, ProjectionElem, ReadOnlyBodyAndCache}; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; pub trait IsPrefixOf<'cx, 'tcx> { fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool; diff --git a/src/librustc_mir/borrow_check/region_infer/mod.rs b/src/librustc_mir/borrow_check/region_infer/mod.rs index 73267b0f39973..7d2384f8a7de7 100644 --- a/src/librustc_mir/borrow_check/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/region_infer/mod.rs @@ -1,6 +1,5 @@ use std::rc::Rc; -use rustc::hir::def_id::DefId; use rustc::infer::canonical::QueryOutlivesConstraint; use rustc::infer::region_constraints::{GenericKind, VarInfos, VerifyBound}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin}; @@ -14,6 +13,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::graph::scc::Sccs; use rustc_data_structures::graph::vec_graph::VecGraph; use rustc_data_structures::graph::WithSuccessors; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::IndexVec; use rustc_span::Span; diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index 369bce64724ab..a963735905e69 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -5,8 +5,6 @@ use std::{fmt, iter, mem}; use either::Either; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::infer::canonical::QueryRegionConstraints; use rustc::infer::outlives::env::RegionBoundPairs; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; @@ -30,6 +28,8 @@ use rustc::ty::{ }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_error_codes::*; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::{Span, DUMMY_SP}; diff --git a/src/librustc_mir/borrow_check/universal_regions.rs b/src/librustc_mir/borrow_check/universal_regions.rs index c7ef017215e0c..6e36508ed60af 100644 --- a/src/librustc_mir/borrow_check/universal_regions.rs +++ b/src/librustc_mir/borrow_check/universal_regions.rs @@ -13,8 +13,6 @@ //! just returns them for other code to use. use either::Either; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, BodyOwnerKind, HirId}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; use rustc::middle::lang_items; use rustc::ty::fold::TypeFoldable; @@ -22,6 +20,9 @@ use rustc::ty::subst::{InternalSubsts, Subst, SubstsRef}; use rustc::ty::{self, RegionVid, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::DiagnosticBuilder; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::{BodyOwnerKind, HirId}; use rustc_index::vec::{Idx, IndexVec}; use std::iter; diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index 4b1a5d0c9a281..2e133a035ee76 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -2,8 +2,8 @@ use crate::build::matches::ArmHasGuard; use crate::build::ForGuard::OutsideGuard; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use crate::hair::*; -use rustc::hir; use rustc::mir::*; +use rustc_hir as hir; use rustc_span::Span; impl<'a, 'tcx> Builder<'a, 'tcx> { diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index 9c7b1129916a3..3f711044b154f 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -3,9 +3,9 @@ use crate::build::scope::DropKind; use crate::build::{BlockAnd, BlockAndExtension, Builder}; use crate::hair::*; -use rustc::hir; use rustc::middle::region; use rustc::mir::*; +use rustc_hir as hir; use rustc_span::symbol::sym; impl<'a, 'tcx> Builder<'a, 'tcx> { diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 2a2c818cb8a95..2cf2b21b65ace 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -3,10 +3,10 @@ use crate::build::expr::category::{Category, RvalueFunc}; use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use crate::hair::*; -use rustc::hir; use rustc::mir::*; use rustc::ty::{self, CanonicalUserTypeAnnotation}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index 9f37e776404ee..ff7049278ed72 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -149,7 +149,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { if let ExprKind::Block { body } = expr.kind { if let Some(tail_expr) = &body.expr { let mut expr = tail_expr; - while let rustc::hir::ExprKind::Block(subblock, _label) = &expr.kind { + while let rustc_hir::ExprKind::Block(subblock, _label) = &expr.kind { if let Some(subtail_expr) = &subblock.expr { expr = subtail_expr } else { diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 468a36267251c..7eea90befb008 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -10,12 +10,12 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard}; use crate::build::{BlockAnd, BlockAndExtension, Builder}; use crate::build::{GuardFrame, GuardFrameLocal, LocalsForNode}; use crate::hair::{self, *}; -use rustc::hir::HirId; use rustc::middle::region; use rustc::mir::*; use rustc::ty::layout::VariantIdx; use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::HirId; use rustc_index::bit_set::BitSet; use rustc_span::Span; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index bbb555a58e69f..9dbf8989cc5aa 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -15,10 +15,10 @@ use crate::build::matches::{Ascription, Binding, Candidate, MatchPair}; use crate::build::Builder; use crate::hair::{self, *}; -use rustc::hir::RangeEnd; use rustc::mir::interpret::truncate; use rustc::ty; use rustc::ty::layout::{Integer, IntegerExt, Size}; +use rustc_hir::RangeEnd; use syntax::attr::{SignedInt, UnsignedInt}; use std::mem; diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index b87cf7610c244..afdb744a43a83 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -9,12 +9,12 @@ use crate::build::matches::{Candidate, MatchPair, Test, TestKind}; use crate::build::Builder; use crate::hair::pattern::compare_const_vals; use crate::hair::*; -use rustc::hir::RangeEnd; use rustc::mir::*; use rustc::ty::layout::VariantIdx; use rustc::ty::util::IntTypeExt; use rustc::ty::{self, adjustment::PointerCast, Ty}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::RangeEnd; use rustc_index::bit_set::BitSet; use rustc_span::symbol::sym; @@ -657,7 +657,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } let no_overlap = (|| { - use rustc::hir::RangeEnd::*; + use rustc_hir::RangeEnd::*; use std::cmp::Ordering::*; let tcx = self.hir.tcx(); diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 39edcc981a005..d6d22db9ff24b 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -4,13 +4,14 @@ use crate::hair::cx::Cx; use crate::hair::{BindingMode, LintLevel, PatKind}; use crate::transform::MirSource; use crate::util as mir_util; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, GeneratorKind, HirIdMap, Node}; use rustc::middle::lang_items; use rustc::middle::region; use rustc::mir::*; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::{GeneratorKind, HirIdMap, Node}; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::symbol::kw; use rustc_span::Span; diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index b05b1d246307c..0aa9773b39a3a 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -84,11 +84,11 @@ should go to. use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG}; use crate::hair::{Expr, ExprRef, LintLevel}; -use rustc::hir; -use rustc::hir::GeneratorKind; use rustc::middle::region; use rustc::mir::*; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::GeneratorKind; use rustc_span::{Span, DUMMY_SP}; use std::collections::hash_map::Entry; use std::mem; diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index d55620f657ba9..671dea6ae7156 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -5,11 +5,11 @@ use crate::interpret::{ InterpResult, MPlaceTy, MemoryKind, OpTy, RawConst, RefTracking, Scalar, ScalarMaybeUndef, StackPopCleanup, }; -use rustc::hir::def::DefKind; use rustc::mir; use rustc::mir::interpret::{ConstEvalErr, ErrorHandled}; use rustc::traits::Reveal; use rustc::ty::{self, layout, layout::LayoutOf, subst::Subst, TyCtxt}; +use rustc_hir::def::DefKind; use rustc_span::source_map::Span; use std::convert::TryInto; diff --git a/src/librustc_mir/const_eval/machine.rs b/src/librustc_mir/const_eval/machine.rs index b39a61c5e0dd1..1aed91baba6a8 100644 --- a/src/librustc_mir/const_eval/machine.rs +++ b/src/librustc_mir/const_eval/machine.rs @@ -1,7 +1,7 @@ -use rustc::hir::def_id::DefId; use rustc::mir; use rustc::ty::layout::HasTyCtxt; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; use std::borrow::{Borrow, Cow}; use std::collections::hash_map::Entry; use std::hash::Hash; diff --git a/src/librustc_mir/dataflow/generic.rs b/src/librustc_mir/dataflow/generic.rs index da2739fd0d6cd..d2ca4f1572c1f 100644 --- a/src/librustc_mir/dataflow/generic.rs +++ b/src/librustc_mir/dataflow/generic.rs @@ -22,10 +22,10 @@ use std::ffi::OsString; use std::path::{Path, PathBuf}; use std::{fs, io, ops}; -use rustc::hir::def_id::DefId; use rustc::mir::{self, traversal, BasicBlock, Location}; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::work_queue::WorkQueue; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::symbol::sym; diff --git a/src/librustc_mir/dataflow/generic/graphviz.rs b/src/librustc_mir/dataflow/generic/graphviz.rs index 399a839c11c6d..e843956a7a78b 100644 --- a/src/librustc_mir/dataflow/generic/graphviz.rs +++ b/src/librustc_mir/dataflow/generic/graphviz.rs @@ -2,8 +2,8 @@ use std::cell::RefCell; use std::io::{self, Write}; use std::{ops, str}; -use rustc::hir::def_id::DefId; use rustc::mir::{self, BasicBlock, Body, Location}; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::{BitSet, HybridBitSet}; use rustc_index::vec::Idx; diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs index 89a0a08a5c6c8..45d2b1a71f0f2 100644 --- a/src/librustc_mir/dataflow/graphviz.rs +++ b/src/librustc_mir/dataflow/graphviz.rs @@ -1,7 +1,7 @@ //! Hook into libgraphviz for rendering dataflow graphs for MIR. -use rustc::hir::def_id::DefId; use rustc::mir::{BasicBlock, Body}; +use rustc_hir::def_id::DefId; use std::fs; use std::io; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index e94f263348d8a..01f6177a93ab4 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -6,11 +6,11 @@ use rustc_data_structures::work_queue::WorkQueue; use rustc_index::bit_set::{BitSet, HybridBitSet}; use rustc_index::vec::Idx; -use rustc::hir::def_id::DefId; use rustc::mir::traversal; use rustc::mir::{self, BasicBlock, BasicBlockData, Body, Location, Statement, Terminator}; use rustc::session::Session; use rustc::ty::{self, TyCtxt}; +use rustc_hir::def_id::DefId; use std::borrow::Borrow; use std::fmt; diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 14f6c3945304d..674c1489b9b68 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -2,9 +2,9 @@ use crate::hair::cx::to_ref::ToRef; use crate::hair::cx::Cx; use crate::hair::{self, *}; -use rustc::hir; use rustc::middle::region; use rustc::ty; +use rustc_hir as hir; use rustc_index::vec::Idx; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 569ac96d369c0..8fd8143ee374f 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -3,14 +3,14 @@ use crate::hair::cx::to_ref::ToRef; use crate::hair::cx::Cx; use crate::hair::util::UserAnnotatedTyHelpers; use crate::hair::*; -use rustc::hir; -use rustc::hir::def::{CtorKind, CtorOf, DefKind, Res}; -use rustc::hir::def_id::LocalDefId; use rustc::mir::interpret::{ErrorHandled, Scalar}; use rustc::mir::BorrowKind; use rustc::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast}; use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, AdtKind, Ty}; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; +use rustc_hir::def_id::LocalDefId; use rustc_index::vec::Idx; use rustc_span::Span; diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index e81dc9ba16d83..2e5ab3343508c 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -6,15 +6,15 @@ use crate::hair::util::UserAnnotatedTyHelpers; use crate::hair::*; use crate::hair::constant::{lit_to_const, LitToConstError}; -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::Node; use rustc::infer::InferCtxt; use rustc::middle::region; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::Subst; use rustc::ty::subst::{GenericArg, InternalSubsts}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Node; use rustc_index::vec::Idx; use rustc_span::symbol::{sym, Symbol}; use syntax::ast; diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index e40e21e76c376..d6859e356eef3 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -1,6 +1,6 @@ use crate::hair::*; -use rustc::hir; +use rustc_hir as hir; pub trait ToRef { type Output; diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 800507e868ca6..cde91cc36cab2 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -5,8 +5,6 @@ //! structures. use self::cx::Cx; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::infer::canonical::Canonical; use rustc::middle::region; use rustc::mir::{BinOp, BorrowKind, Field, UnOp}; @@ -14,6 +12,8 @@ use rustc::ty::adjustment::PointerCast; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc::ty::{AdtDef, Const, Ty, UpvarSubsts, UserType}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::Span; mod constant; diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 61d2eceb30877..03120e8009f0a 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -235,10 +235,10 @@ use rustc_index::vec::Idx; use super::{compare_const_vals, PatternFoldable, PatternFolder}; use super::{FieldPat, Pat, PatKind, PatRange}; -use rustc::hir::def_id::DefId; -use rustc::hir::{HirId, RangeEnd}; use rustc::ty::layout::{Integer, IntegerExt, Size, VariantIdx}; use rustc::ty::{self, Const, Ty, TyCtxt, TypeFoldable, VariantDef}; +use rustc_hir::def_id::DefId; +use rustc_hir::{HirId, RangeEnd}; use rustc::lint; use rustc::mir::interpret::{truncate, AllocId, ConstValue, Pointer, Scalar}; diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index bbbad36e4851d..ca7912b447e28 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -4,17 +4,17 @@ use super::_match::{expand_pattern, is_useful, MatchCheckCtxt, Matrix, PatStack} use super::{PatCtxt, PatKind, PatternError}; -use rustc::hir::def::*; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::HirId; -use rustc::hir::{self, Pat}; use rustc::lint; use rustc::session::Session; use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_error_codes::*; use rustc_errors::{Applicability, DiagnosticBuilder}; +use rustc_hir as hir; +use rustc_hir::def::*; +use rustc_hir::def_id::DefId; +use rustc_hir::{HirId, Pat}; use rustc_span::symbol::sym; use rustc_span::{MultiSpan, Span}; use syntax::ast::Mutability; diff --git a/src/librustc_mir/hair/pattern/const_to_pat.rs b/src/librustc_mir/hair/pattern/const_to_pat.rs index dd97565f55abe..d4975df2e68cb 100644 --- a/src/librustc_mir/hair/pattern/const_to_pat.rs +++ b/src/librustc_mir/hair/pattern/const_to_pat.rs @@ -1,11 +1,11 @@ use crate::const_eval::const_variant_index; -use rustc::hir; use rustc::infer::InferCtxt; use rustc::lint; use rustc::mir::Field; use rustc::traits::{ObligationCause, PredicateObligation}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; use rustc_index::vec::Idx; diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index f5d8ed877ec5c..bac40a06c78d5 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -9,9 +9,6 @@ pub(crate) use self::check_match::check_match; use crate::hair::constant::*; use crate::hair::util::UserAnnotatedTyHelpers; -use rustc::hir::def::{CtorKind, CtorOf, DefKind, Res}; -use rustc::hir::pat_util::EnumerateAndAdjustIterator; -use rustc::hir::{self, RangeEnd}; use rustc::mir::interpret::{get_slice_bytes, sign_extend, ConstValue, ErrorHandled}; use rustc::mir::UserTypeProjection; use rustc::mir::{BorrowKind, Field, Mutability}; @@ -19,13 +16,16 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::subst::{GenericArg, SubstsRef}; use rustc::ty::{self, AdtDef, DefIdTree, Region, Ty, TyCtxt, UserType}; use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations}; - +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; +use rustc_hir::pat_util::EnumerateAndAdjustIterator; +use rustc_hir::RangeEnd; use rustc_index::vec::Idx; - use rustc_span::{Span, DUMMY_SP}; +use syntax::ast; + use std::cmp::Ordering; use std::fmt; -use syntax::ast; use rustc_error_codes::*; @@ -814,7 +814,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { } } hir::ExprKind::Path(ref qpath) => *self.lower_path(qpath, expr.hir_id, expr.span).kind, - hir::ExprKind::Unary(hir::UnNeg, ref expr) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref expr) => { let ty = self.tables.expr_ty(expr); let lit = match expr.kind { hir::ExprKind::Lit(ref lit) => lit, diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index 53880b0d9b5fc..c27844ed0d032 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -1,5 +1,5 @@ -use rustc::hir; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; +use rustc_hir as hir; crate trait UserAnnotatedTyHelpers<'tcx> { fn tcx(&self) -> TyCtxt<'tcx>; diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 5c5159749a3c5..551e3e837c988 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -2,8 +2,6 @@ use std::cell::Cell; use std::fmt::Write; use std::mem; -use rustc::hir::def::DefKind; -use rustc::hir::def_id::DefId; use rustc::ich::StableHashingContext; use rustc::mir; use rustc::mir::interpret::{ @@ -15,6 +13,8 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::DefId; use rustc_index::vec::IndexVec; use rustc_macros::HashStable; use rustc_span::source_map::{self, Span, DUMMY_SP}; diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index 9f54d4c3212e9..7c6129ef30ffd 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -4,10 +4,10 @@ //! memory, we need to extract all memory allocations to the global memory pool so they stay around. use super::validity::RefTracking; -use rustc::hir; use rustc::mir::interpret::{ErrorHandled, InterpResult}; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; use syntax::ast::Mutability; diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index b075e8ea383e1..cd6d94357e414 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -2,7 +2,6 @@ //! looking at their MIR. Intrinsics/functions supported here are shared by CTFE //! and miri. -use rustc::hir::def_id::DefId; use rustc::mir::{ self, interpret::{ConstValue, GlobalId, InterpResult, Scalar}, @@ -12,6 +11,7 @@ use rustc::ty; use rustc::ty::layout::{LayoutOf, Primitive, Size}; use rustc::ty::subst::SubstsRef; use rustc::ty::TyCtxt; +use rustc_hir::def_id::DefId; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 659651e6165ef..eed47c147c60d 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -1,4 +1,3 @@ -use rustc::hir::def_id::CrateNum; use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::mir::interpret::Allocation; use rustc::ty::{ @@ -7,6 +6,7 @@ use rustc::ty::{ subst::{GenericArg, GenericArgKind}, Ty, TyCtxt, }; +use rustc_hir::def_id::CrateNum; use std::fmt::Write; struct AbsolutePathPrinter<'tcx> { diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 3dc572d256d8e..6d15827536c55 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -5,9 +5,9 @@ use std::borrow::{Borrow, Cow}; use std::hash::Hash; -use rustc::hir::def_id::DefId; use rustc::mir; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; use rustc_span::Span; use super::{ diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index b55f66dc75124..7b82bed2e7a61 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -7,10 +7,10 @@ use std::fmt::Write; use std::ops::RangeInclusive; -use rustc::hir; use rustc::ty; use rustc::ty::layout::{self, LayoutOf, TyLayout, VariantIdx}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; use rustc_span::symbol::{sym, Symbol}; use std::hash::Hash; diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 910286f55740f..fc7f2eb18b23a 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -1,10 +1,10 @@ -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::FnKind; use rustc::hir::map::blocks::FnLikeNode; use rustc::lint::builtin::UNCONDITIONAL_RECURSION; use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt}; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; pub fn check(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, def_id: DefId) { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 231ee792918b3..519511f20f967 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -176,9 +176,6 @@ use crate::monomorphize; -use rustc::hir; -use rustc::hir::def_id::{DefId, DefIdMap, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem}; use rustc::mir::interpret::{AllocId, ConstValue}; @@ -193,6 +190,9 @@ use rustc::ty::subst::{InternalSubsts, Subst, SubstsRef}; use rustc::ty::{self, GenericParamDefKind, Instance, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::{par_iter, MTLock, MTRef, ParallelIterator}; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIdMap, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_index::bit_set::GrowableBitSet; use std::iter; diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 766d6bbe5176d..c004417b3373f 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -96,8 +96,6 @@ use std::cmp; use std::collections::hash_map::Entry; use std::sync::Arc; -use rustc::hir::def::DefKind; -use rustc::hir::def_id::{CrateNum, DefId, DefIdSet, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::middle::exported_symbols::SymbolExportLevel; use rustc::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, Linkage, Visibility}; @@ -106,6 +104,8 @@ use rustc::ty::print::characteristic_def_id_of_type; use rustc::ty::query::Providers; use rustc::ty::{self, DefIdTree, InstanceDef, TyCtxt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_span::symbol::Symbol; use crate::monomorphize::collector::InliningMap; diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 5d88f3b93aeb3..01cecdd067945 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -1,10 +1,10 @@ -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::layout::VariantIdx; use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_index::vec::{Idx, IndexVec}; diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index dbbbbeff51338..33eafeca5b17e 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -1,6 +1,6 @@ -use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::TyCtxt; +use rustc_hir::def_id::DefId; use crate::transform::{MirPass, MirSource}; use crate::util; diff --git a/src/librustc_mir/transform/check_consts/mod.rs b/src/librustc_mir/transform/check_consts/mod.rs index b50ce0a0e003e..b7383663932a4 100644 --- a/src/librustc_mir/transform/check_consts/mod.rs +++ b/src/librustc_mir/transform/check_consts/mod.rs @@ -4,9 +4,10 @@ //! has interior mutability or needs to be dropped, as well as the visitor that emits errors when //! it finds operations that are invalid in a certain context. -use rustc::hir::{self, def_id::DefId}; use rustc::mir; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use std::fmt; diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index 605281326f65a..1583647a4d414 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -1,8 +1,8 @@ //! Concrete error types for all operations which may be invalid in a certain const context. -use rustc::hir::def_id::DefId; use rustc::session::config::nightly_options; use rustc::ty::TyCtxt; +use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use rustc_span::{Span, Symbol}; use syntax::feature_gate::feature_err; diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 94b3b51f0b379..3c52a2e0dd270 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -1,6 +1,5 @@ //! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations. -use rustc::hir::{def_id::DefId, HirId}; use rustc::middle::lang_items; use rustc::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor}; use rustc::mir::*; @@ -8,6 +7,7 @@ use rustc::traits::{self, TraitEngine}; use rustc::ty::cast::CastTy; use rustc::ty::{self, TyCtxt}; use rustc_error_codes::*; +use rustc_hir::{def_id::DefId, HirId}; use rustc_index::bit_set::BitSet; use rustc_span::symbol::sym; use rustc_span::Span; diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index c637557344178..b333bc681f6bb 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -1,15 +1,14 @@ -use rustc_data_structures::fx::FxHashSet; - -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::Node; +use rustc::hir::intravisit; use rustc::lint::builtin::{SAFE_PACKED_BORROWS, UNUSED_UNSAFE}; use rustc::mir::visit::{MutatingUseContext, PlaceContext, Visitor}; use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; - +use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Node; use rustc_span::symbol::{sym, Symbol}; use std::ops::Bound; @@ -474,15 +473,15 @@ struct UnusedUnsafeVisitor<'a> { unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>, } -impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { - fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> { - hir::intravisit::NestedVisitorMap::None +impl<'a, 'tcx> intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { + fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { + intravisit::NestedVisitorMap::None } fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) { - hir::intravisit::walk_block(self, block); + intravisit::walk_block(self, block); - if let hir::UnsafeBlock(hir::UserProvided) = block.rules { + if let hir::BlockCheckMode::UnsafeBlock(hir::UnsafeSource::UserProvided) = block.rules { self.unsafe_blocks.push((block.hir_id, self.used_unsafe.contains(&block.hir_id))); } } @@ -508,7 +507,7 @@ fn check_unused_unsafe( debug!("check_unused_unsafe({:?}, body={:?}, used_unsafe={:?})", def_id, body, used_unsafe); let mut visitor = UnusedUnsafeVisitor { used_unsafe, unsafe_blocks }; - hir::intravisit::Visitor::visit_body(&mut visitor, body); + intravisit::Visitor::visit_body(&mut visitor, body); } fn unsafety_check_result(tcx: TyCtxt<'_>, def_id: DefId) -> UnsafetyCheckResult { diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 31c3a2c7ebceb..6b0f7be86841e 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -4,9 +4,6 @@ use std::borrow::Cow; use std::cell::Cell; -use rustc::hir::def::DefKind; -use rustc::hir::def_id::DefId; -use rustc::hir::HirId; use rustc::mir::interpret::{InterpResult, PanicInfo, Scalar}; use rustc::mir::visit::{ MutVisitor, MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor, @@ -23,6 +20,9 @@ use rustc::ty::layout::{ use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, Instance, ParamEnv, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::DefId; +use rustc_hir::HirId; use rustc_index::vec::IndexVec; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::Mutability; diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 860a014c5173c..86baf4deb5197 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -9,11 +9,11 @@ use crate::transform::{MirPass, MirSource}; use crate::util::elaborate_drops::{elaborate_drop, DropFlagState, Unwind}; use crate::util::elaborate_drops::{DropElaborator, DropFlagMode, DropStyle}; use crate::util::patch::MirPatch; -use rustc::hir; use rustc::mir::*; use rustc::ty::layout::VariantIdx; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; use rustc_index::bit_set::BitSet; use rustc_span::Span; use std::fmt; diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index fc4f8031960b7..96fb992e53b23 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -57,8 +57,6 @@ use crate::transform::simplify; use crate::transform::{MirPass, MirSource}; use crate::util::dump_mir; use crate::util::liveness; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::mir::visit::{MutVisitor, PlaceContext, Visitor}; use rustc::mir::*; use rustc::ty::layout::VariantIdx; @@ -66,6 +64,8 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::GeneratorSubsts; use rustc::ty::{self, AdtDef, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::{BitMatrix, BitSet}; use rustc_index::vec::{Idx, IndexVec}; use std::borrow::Cow; diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 52a105658bdcd..3c5d2c9f310bb 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -1,6 +1,6 @@ //! Inlining pass for MIR functions -use rustc::hir::def_id::DefId; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 7cf94f7260fd4..82c31a09ce377 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -1,11 +1,11 @@ use crate::{build, shim}; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::mir::{BodyAndCache, ConstQualifs, MirPhase, Promoted}; use rustc::ty::query::Providers; use rustc::ty::steal::Steal; use rustc::ty::{InstanceDef, TyCtxt, TypeFoldable}; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE}; use rustc_index::vec::IndexVec; use rustc_span::Span; use std::borrow::Cow; diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 819ed9a51e7bf..b6656e720c5c3 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -12,13 +12,13 @@ //! initialization and can otherwise silence errors, if //! move analysis runs after promotion on broken MIR. -use rustc::hir::def_id::DefId; use rustc::mir::traversal::ReversePostorder; use rustc::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor}; use rustc::mir::*; use rustc::ty::cast::CastTy; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, List, TyCtxt, TypeFoldable}; +use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use rustc_span::{Span, DUMMY_SP}; use syntax::ast::LitKind; diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 3741ca17a1115..9dea44e020010 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -1,7 +1,7 @@ -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::{self, adjustment::PointerCast, Predicate, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use std::borrow::Cow; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 394924f5d6a31..7a90cb0390e52 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -4,9 +4,9 @@ use rustc_target::spec::abi::Abi; use syntax::ast; use crate::transform::{MirPass, MirSource}; -use rustc::hir::def_id::DefId; use rustc::mir::{self, Body, BodyAndCache, Local, Location}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use crate::dataflow::move_paths::{HasMoveData, MoveData}; diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 7fd67385edd5a..aacefeb75136e 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -1,5 +1,4 @@ use crate::util::patch::MirPatch; -use rustc::hir; use rustc::middle::lang_items; use rustc::mir::*; use rustc::traits::Reveal; @@ -7,6 +6,7 @@ use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc::ty::util::IntTypeExt; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; use rustc_index::vec::Idx; use std::fmt; diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index fb53888b755bc..8291bc958808d 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -1,6 +1,6 @@ -use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::TyCtxt; +use rustc_hir::def_id::DefId; use rustc_index::vec::Idx; use std::fmt::Debug; use std::io::{self, Write}; diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index a3f85238f472e..e0919e7e8f879 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -1,10 +1,10 @@ use super::graphviz::write_mir_fn_graphviz; use crate::transform::MirSource; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::visit::Visitor; use rustc::mir::*; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_index::vec::Idx; use std::fmt::Display; use std::fmt::Write as _; @@ -540,7 +540,7 @@ fn write_mir_sig( body: &Body<'_>, w: &mut dyn Write, ) -> io::Result<()> { - use rustc::hir::def::DefKind; + use rustc_hir::def::DefKind; trace!("write_mir_sig: {:?}", src.instance); let kind = tcx.def_kind(src.def_id()); diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index b33b891d4bb53..ced933ba3ee42 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -13,6 +13,7 @@ log = "0.4" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } +rustc_hir = { path = "../librustc_hir" } rustc_index = { path = "../librustc_index" } rustc_parse = { path = "../librustc_parse" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index c08aab2e200fc..30ec0fe7185cd 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -7,14 +7,14 @@ //! errors. We still look for those primitives in the MIR const-checker to ensure nothing slips //! through, but errors for structured control flow in a `const` should be emitted here. -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; +use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::map::Map; use rustc::session::config::nightly_options; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_error_codes::*; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::{sym, Span, Symbol}; use syntax::ast::Mutability; use syntax::feature_gate::feature_err; @@ -206,12 +206,12 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { fn visit_anon_const(&mut self, anon: &'tcx hir::AnonConst) { let kind = Some(ConstKind::AnonConst); - self.recurse_into(kind, |this| hir::intravisit::walk_anon_const(this, anon)); + self.recurse_into(kind, |this| intravisit::walk_anon_const(this, anon)); } fn visit_body(&mut self, body: &'tcx hir::Body<'tcx>) { let kind = ConstKind::for_body(body, self.tcx.hir()); - self.recurse_into(kind, |this| hir::intravisit::walk_body(this, body)); + self.recurse_into(kind, |this| intravisit::walk_body(this, body)); } fn visit_pat(&mut self, p: &'tcx hir::Pat<'tcx>) { @@ -220,7 +220,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { self.const_check_violated(NonConstExpr::OrPattern, p.span); } } - hir::intravisit::walk_pat(self, p) + intravisit::walk_pat(self, p) } fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) { @@ -250,6 +250,6 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { _ => {} } - hir::intravisit::walk_expr(self, e); + intravisit::walk_expr(self, e); } } diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index f9db1a21cc87d..0c435a1666363 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -3,17 +3,16 @@ // from live codes are live, and everything else is dead. use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::Node; -use rustc::hir::{self, PatKind, TyKind}; - -use rustc::hir::def::{CtorOf, DefKind, Res}; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::lint; use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc::middle::privacy; use rustc::ty::{self, DefIdTree, TyCtxt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{CtorOf, DefKind, Res}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::{Node, PatKind, TyKind}; use rustc_span; use rustc_span::symbol::sym; diff --git a/src/librustc_passes/diagnostic_items.rs b/src/librustc_passes/diagnostic_items.rs index 6b2c42602ff0b..f84f998420236 100644 --- a/src/librustc_passes/diagnostic_items.rs +++ b/src/librustc_passes/diagnostic_items.rs @@ -9,12 +9,12 @@ //! //! * Compiler internal types like `Ty` and `TyCtxt` -use rustc::hir; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::{sym, Symbol}; use syntax::ast; diff --git a/src/librustc_passes/entry.rs b/src/librustc_passes/entry.rs index 3a7d1780d470d..0817cb0060515 100644 --- a/src/librustc_passes/entry.rs +++ b/src/librustc_passes/entry.rs @@ -1,11 +1,11 @@ -use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::map as hir_map; -use rustc::hir::{HirId, ImplItem, Item, ItemKind, TraitItem}; use rustc::session::config::EntryFnType; use rustc::session::{config, Session}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::{HirId, ImplItem, Item, ItemKind, TraitItem}; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::attr; diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 4341ebfc45736..3eca602cf8603 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -3,9 +3,10 @@ // completely accurate (some things might be counted twice, others missed). use rustc::hir::intravisit as hir_visit; -use rustc::hir::{self, HirId}; use rustc::util::common::to_readable_str; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::HirId; use rustc_span::Span; use syntax::ast::{self, AttrId, NodeId}; use syntax::visit as ast_visit; diff --git a/src/librustc_passes/intrinsicck.rs b/src/librustc_passes/intrinsicck.rs index 95dc31cc29bf4..cc311916cab91 100644 --- a/src/librustc_passes/intrinsicck.rs +++ b/src/librustc_passes/intrinsicck.rs @@ -1,11 +1,11 @@ -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::DefId; use rustc::ty::layout::{LayoutError, Pointer, SizeSkeleton, VariantIdx}; use rustc::ty::query::Providers; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::DefId; -use rustc::hir; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; +use rustc_hir as hir; use rustc_index::vec::Idx; use rustc_span::{sym, Span}; use rustc_target::spec::abi::Abi::RustIntrinsic; diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index 02eecc2998bb7..be3e1f4738234 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -1,7 +1,3 @@ -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::ItemKind; use rustc::ty::layout::HasDataLayout; use rustc::ty::layout::HasParamEnv; use rustc::ty::layout::HasTyCtxt; @@ -11,6 +7,10 @@ use rustc::ty::layout::TyLayout; use rustc::ty::ParamEnv; use rustc::ty::Ty; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::ItemKind; use rustc_span::symbol::sym; use syntax::ast::Attribute; diff --git a/src/librustc_passes/lib_features.rs b/src/librustc_passes/lib_features.rs index 0d39ea85b50aa..df3e4ee3af540 100644 --- a/src/librustc_passes/lib_features.rs +++ b/src/librustc_passes/lib_features.rs @@ -4,11 +4,11 @@ // and `#[unstable (..)]`), but are not declared in one single location // (unlike lang features), which means we need to collect them instead. -use rustc::hir::def_id::LOCAL_CRATE; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::middle::lib_features::LibFeatures; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_span::symbol::Symbol; use rustc_span::{sym, Span}; use syntax::ast::{Attribute, MetaItem, MetaItemKind}; diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index 6a38524720e27..3ae5e4f72b744 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -96,24 +96,25 @@ use self::LiveNodeKind::*; use self::VarKind::*; -use rustc::hir::def::*; -use rustc::hir::def_id::DefId; +use errors::Applicability; use rustc::hir::intravisit::{self, FnKind, NestedVisitorMap, Visitor}; -use rustc::hir::{self, Expr, HirId, HirIdMap, HirIdSet, Node}; use rustc::lint; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; - -use errors::Applicability; use rustc_data_structures::fx::FxIndexMap; +use rustc_hir as hir; +use rustc_hir::def::*; +use rustc_hir::def_id::DefId; +use rustc_hir::{Expr, HirId, HirIdMap, HirIdSet, Node}; use rustc_span::symbol::sym; use rustc_span::Span; +use syntax::ast; + use std::collections::VecDeque; use std::io; use std::io::prelude::*; use std::rc::Rc; use std::{fmt, u32}; -use syntax::ast; #[derive(Copy, Clone, PartialEq)] struct Variable(u32); @@ -375,7 +376,7 @@ fn visit_fn<'tcx>( for param in body.params { let is_shorthand = match param.pat.kind { - rustc::hir::PatKind::Struct(..) => true, + rustc_hir::PatKind::Struct(..) => true, _ => false, }; param.pat.each_binding(|_bm, hir_id, _x, ident| { @@ -409,7 +410,7 @@ fn add_from_pat(ir: &mut IrMaps<'_>, pat: &hir::Pat<'_>) { let mut pats = VecDeque::new(); pats.push_back(pat); while let Some(pat) = pats.pop_front() { - use rustc::hir::PatKind::*; + use rustc_hir::PatKind::*; match &pat.kind { Binding(.., inner_pat) => { pats.extend(inner_pat.iter()); diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index f5011ceef142e..ec8c8ee8be9b0 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -3,12 +3,13 @@ use Context::*; use rustc::session::Session; use errors::Applicability; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::map::Map; -use rustc::hir::{self, Destination, Movability, Node}; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::{Destination, Movability, Node}; use rustc_span::Span; use syntax::struct_span_err; diff --git a/src/librustc_passes/reachable.rs b/src/librustc_passes/reachable.rs index 4bcba96910bde..9b529401049b0 100644 --- a/src/librustc_passes/reachable.rs +++ b/src/librustc_passes/reachable.rs @@ -5,14 +5,8 @@ // makes all other generics or inline functions that it references // reachable as well. -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::LOCAL_CRATE; -use rustc::hir::def_id::{CrateNum, DefId}; use rustc::hir::intravisit; use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::Node; -use rustc::hir::{self, HirIdSet}; use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc::middle::privacy; use rustc::session::config; @@ -20,6 +14,12 @@ use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::LOCAL_CRATE; +use rustc_hir::def_id::{CrateNum, DefId}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::{HirIdSet, Node}; use rustc_target::spec::abi::Abi; // Returns true if the given item must be inlined because it may be diff --git a/src/librustc_passes/region.rs b/src/librustc_passes/region.rs index 7652d5a36ee19..f2aa5aff17166 100644 --- a/src/librustc_passes/region.rs +++ b/src/librustc_passes/region.rs @@ -6,15 +6,14 @@ //! //! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::Node; -use rustc::hir::{Arm, Block, Expr, Local, Pat, PatKind, Stmt}; use rustc::middle::region::*; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt}; use rustc_index::vec::Idx; use rustc_span::source_map; use rustc_span::Span; @@ -651,7 +650,7 @@ fn resolve_local<'tcx>( match expr.kind { hir::ExprKind::AddrOf(_, _, ref subexpr) - | hir::ExprKind::Unary(hir::UnDeref, ref subexpr) + | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref subexpr) | hir::ExprKind::Field(ref subexpr, _) | hir::ExprKind::Index(ref subexpr, _) => { expr = &subexpr; diff --git a/src/librustc_passes/stability.rs b/src/librustc_passes/stability.rs index 60f26625a2e87..4c5b57791c552 100644 --- a/src/librustc_passes/stability.rs +++ b/src/librustc_passes/stability.rs @@ -1,10 +1,7 @@ //! A pass that annotates every item and method with its stability level, //! propagating default levels lexically from parent to children ast nodes. -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::{self, Generics, HirId, Item, StructField, Variant}; use rustc::lint; use rustc::middle::privacy::AccessLevels; use rustc::middle::stability::{DeprecationEntry, Index}; @@ -12,6 +9,10 @@ use rustc::session::Session; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::{Generics, HirId, Item, StructField, Variant}; use rustc_span::symbol::{sym, Symbol}; use rustc_span::Span; use syntax::ast::Attribute; diff --git a/src/librustc_plugin_impl/Cargo.toml b/src/librustc_plugin_impl/Cargo.toml index a9bbe429c00cc..54cceca7d3afb 100644 --- a/src/librustc_plugin_impl/Cargo.toml +++ b/src/librustc_plugin_impl/Cargo.toml @@ -12,6 +12,7 @@ doctest = false [dependencies] rustc = { path = "../librustc" } +rustc_hir = { path = "../librustc_hir" } rustc_metadata = { path = "../librustc_metadata" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_plugin_impl/build.rs b/src/librustc_plugin_impl/build.rs index 2424ee5a9df00..c4b644031d3a6 100644 --- a/src/librustc_plugin_impl/build.rs +++ b/src/librustc_plugin_impl/build.rs @@ -1,10 +1,10 @@ //! Used by `rustc` when compiling a plugin crate. -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::attr; diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index e39c0b427dab1..6c9a2d65ef7df 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -10,6 +10,7 @@ path = "lib.rs" [dependencies] rustc = { path = "../librustc" } +rustc_hir = { path = "../librustc_hir" } rustc_typeck = { path = "../librustc_typeck" } syntax = { path = "../libsyntax" } rustc_span = { path = "../librustc_span" } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 68e5e6d2543a6..c932e8bb1f46d 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -7,10 +7,7 @@ extern crate syntax; use rustc::bug; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::intravisit::{self, DeepVisitor, NestedVisitorMap, Visitor}; -use rustc::hir::{self, AssocItemKind, HirIdSet, Node, PatKind}; use rustc::lint; use rustc::middle::privacy::{AccessLevel, AccessLevels}; use rustc::ty::fold::TypeVisitor; @@ -18,6 +15,10 @@ use rustc::ty::query::Providers; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::{AssocItemKind, HirIdSet, Node, PatKind}; use rustc_span::hygiene::Transparency; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index 593662c1180db..01e5d75d2b57d 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -22,6 +22,7 @@ rustc = { path = "../librustc" } rustc_ast_lowering = { path = "../librustc_ast_lowering" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } +rustc_hir = { path = "../librustc_hir" } rustc_metadata = { path = "../librustc_metadata" } rustc_error_codes = { path = "../librustc_error_codes" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 613fad644f64d..46dde451c7ffc 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -17,11 +17,11 @@ use crate::{ use crate::{Module, ModuleData, ModuleKind, NameBinding, NameBindingKind, Segment, ToNameBinding}; use rustc::bug; -use rustc::hir::def::{self, *}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::exports::Export; use rustc::middle::cstore::CrateStore; use rustc::ty; +use rustc_hir::def::{self, *}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc_metadata::creader::LoadedMacro; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs index 5aea813c6b86d..f564ea644bdc1 100644 --- a/src/librustc_resolve/def_collector.rs +++ b/src/librustc_resolve/def_collector.rs @@ -1,7 +1,7 @@ use log::debug; -use rustc::hir::def_id::DefIndex; use rustc::hir::map::definitions::*; use rustc_expand::expand::AstFragment; +use rustc_hir::def_id::DefIndex; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 1d45f1cd9124a..ba3d23145692e 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -3,13 +3,13 @@ use std::cmp::Reverse; use errors::{Applicability, DiagnosticBuilder}; use log::debug; use rustc::bug; -use rustc::hir::def::Namespace::{self, *}; -use rustc::hir::def::{self, DefKind, NonMacroAttrKind}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; use rustc::session::Session; use rustc::ty::{self, DefIdTree}; use rustc_data_structures::fx::FxHashSet; use rustc_feature::BUILTIN_ATTRIBUTES; +use rustc_hir::def::Namespace::{self, *}; +use rustc_hir::def::{self, DefKind, NonMacroAttrKind}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX}; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::SourceMap; use rustc_span::symbol::{kw, Symbol}; diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index cc35b7748ef44..5ede0564b1ae5 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -13,8 +13,6 @@ use crate::{NameBinding, NameBindingKind, PathResult, PrivacyError, ToNameBindin use errors::{pluralize, Applicability}; -use rustc::hir::def::{self, PartialRes}; -use rustc::hir::def_id::DefId; use rustc::hir::exports::Export; use rustc::lint::builtin::BuiltinLintDiagnostics; use rustc::lint::builtin::{PUB_USE_OF_PRIVATE_EXTERN_CRATE, UNUSED_IMPORTS}; @@ -23,6 +21,8 @@ use rustc::ty; use rustc::{bug, span_bug}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::ptr_key::PtrKey; +use rustc_hir::def::{self, PartialRes}; +use rustc_hir::def_id::DefId; use rustc_span::hygiene::ExpnId; use rustc_span::symbol::kw; use rustc_span::{MultiSpan, Span}; diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index 84cb3f7181996..fb7aacba2dc48 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -12,12 +12,12 @@ use crate::{Module, ModuleOrUniformRoot, NameBindingKind, ParentScope, PathResul use crate::{ResolutionError, Resolver, Segment, UseError}; use log::debug; -use rustc::hir::def::Namespace::{self, *}; -use rustc::hir::def::{self, CtorKind, DefKind, PartialRes, PerNS}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; -use rustc::hir::TraitCandidate; use rustc::{bug, lint, span_bug}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def::Namespace::{self, *}; +use rustc_hir::def::{self, CtorKind, DefKind, PartialRes, PerNS}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX}; +use rustc_hir::TraitCandidate; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index cd94229b0abc5..5a12a75a8556e 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -6,12 +6,12 @@ use crate::{PathResult, PathSource, Segment}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use log::debug; -use rustc::hir::def::Namespace::{self, *}; -use rustc::hir::def::{self, CtorKind, DefKind}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; -use rustc::hir::PrimTy; use rustc::session::config::nightly_options; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def::Namespace::{self, *}; +use rustc_hir::def::{self, CtorKind, DefKind}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX}; +use rustc_hir::PrimTy; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::kw; use rustc_span::Span; diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 72e0dc32c2103..199752b93c137 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -16,18 +16,13 @@ #![feature(nll)] #![recursion_limit = "256"] -pub use rustc::hir::def::{Namespace, PerNS}; +pub use rustc_hir::def::{Namespace, PerNS}; use Determinacy::*; use errors::{Applicability, DiagnosticBuilder}; -use rustc::hir::def::Namespace::*; -use rustc::hir::def::{self, CtorKind, CtorOf, DefKind, NonMacroAttrKind, PartialRes}; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::hir::exports::ExportMap; use rustc::hir::map::Definitions; -use rustc::hir::{Bool, Char, Float, Int, PrimTy, Str, Uint}; -use rustc::hir::{GlobMap, TraitMap}; use rustc::lint; use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn}; use rustc::session::Session; @@ -38,6 +33,11 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::ptr_key::PtrKey; use rustc_data_structures::sync::Lrc; use rustc_expand::base::SyntaxExtension; +use rustc_hir::def::Namespace::*; +use rustc_hir::def::{self, CtorKind, CtorOf, DefKind, NonMacroAttrKind, PartialRes}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::PrimTy::{self, Bool, Char, Float, Int, Str, Uint}; +use rustc_hir::{GlobMap, TraitMap}; use rustc_metadata::creader::{CStore, CrateLoader}; use rustc_session::node_id::{NodeMap, NodeSet}; use rustc_span::hygiene::{ExpnId, ExpnKind, MacroKind, SyntaxContext, Transparency}; diff --git a/src/librustc_resolve/lifetimes.rs b/src/librustc_resolve/lifetimes.rs index 5d82c17725944..4cd3a9e1a8082 100644 --- a/src/librustc_resolve/lifetimes.rs +++ b/src/librustc_resolve/lifetimes.rs @@ -6,18 +6,19 @@ //! way. Therefore, we break lifetime name resolution into a separate pass. use errors::{pluralize, Applicability, DiagnosticBuilder}; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::map::Map; -use rustc::hir::{self, GenericParamKind, HirIdMap, HirIdSet, LifetimeParamKind}; -use rustc::hir::{GenericArg, GenericParam, LifetimeName, Node, ParamName, QPath}; use rustc::lint; use rustc::middle::resolve_lifetime::*; use rustc::session::Session; use rustc::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use rustc::{bug, span_bug}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE}; +use rustc_hir::{GenericArg, GenericParam, LifetimeName, Node, ParamName, QPath}; +use rustc_hir::{GenericParamKind, HirIdMap, HirIdSet, LifetimeParamKind}; use rustc_span::symbol::{kw, sym}; use rustc_span::Span; use std::borrow::Cow; @@ -846,8 +847,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) { let output = match fd.output { - hir::DefaultReturn(_) => None, - hir::Return(ref ty) => Some(&**ty), + hir::FunctionRetTy::DefaultReturn(_) => None, + hir::FunctionRetTy::Return(ref ty) => Some(&**ty), }; self.visit_fn_like_elision(&fd.inputs, output); } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index a2ef6ad70f907..1103d5b5b7c97 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -6,8 +6,6 @@ use crate::Namespace::*; use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy}; use crate::{CrateLint, ParentScope, ResolutionError, Resolver, Scope, ScopeSet, Weak}; use crate::{ModuleKind, ModuleOrUniformRoot, NameBinding, PathResult, Segment, ToNameBinding}; -use rustc::hir::def::{self, DefKind, NonMacroAttrKind}; -use rustc::hir::def_id; use rustc::middle::stability; use rustc::session::Session; use rustc::{lint, span_bug, ty}; @@ -17,6 +15,8 @@ use rustc_expand::base::{self, Indeterminate, InvocationRes}; use rustc_expand::compile_declarative_macro; use rustc_expand::expand::{AstFragment, AstFragmentKind, Invocation, InvocationKind}; use rustc_feature::is_builtin_attr_name; +use rustc_hir::def::{self, DefKind, NonMacroAttrKind}; +use rustc_hir::def_id; use rustc_span::edition::Edition; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; use rustc_span::symbol::{kw, sym, Symbol}; diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index cc31f78c5e941..e7a7eefc509e1 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -13,6 +13,7 @@ log = "0.4" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_codegen_utils = { path = "../librustc_codegen_utils" } +rustc_hir = { path = "../librustc_hir" } rustc_parse = { path = "../librustc_parse" } serde_json = "1" syntax = { path = "../libsyntax" } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index a61030afa19db..2f2ba560fa20a 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -13,12 +13,12 @@ //! DumpVisitor walks the AST and processes it, and Dumper is used for //! recording the output. -use rustc::hir::def::{DefKind as HirDefKind, Res}; -use rustc::hir::def_id::DefId; use rustc::session::config::Input; use rustc::span_bug; use rustc::ty::{self, DefIdTree, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def::{DefKind as HirDefKind, Res}; +use rustc_hir::def_id::DefId; use std::env; use std::path::Path; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 1f72d1dd847b9..c3221d925bc3b 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -8,16 +8,16 @@ mod dumper; mod span_utils; mod sig; -use rustc::hir; -use rustc::hir::def::{CtorOf, DefKind as HirDefKind, Res}; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::Node; use rustc::middle::cstore::ExternCrate; use rustc::middle::privacy::AccessLevels; use rustc::session::config::{CrateType, Input, OutputType}; use rustc::ty::{self, DefIdTree, TyCtxt}; use rustc::{bug, span_bug}; use rustc_codegen_utils::link::{filename_for_metadata, out_filename}; +use rustc_hir as hir; +use rustc_hir::def::{CtorOf, DefKind as HirDefKind, Res}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::Node; use std::cell::Cell; use std::default::Default; diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 3ae15cd81a271..e7b86cfba4f7d 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -29,7 +29,7 @@ use crate::{id_from_def_id, id_from_node_id, SaveContext}; use rls_data::{SigElement, Signature}; -use rustc::hir::def::{DefKind, Res}; +use rustc_hir::def::{DefKind, Res}; use syntax::ast::{self, Extern, NodeId}; use syntax::print::pprust; diff --git a/src/librustc_span/lib.rs b/src/librustc_span/lib.rs index a58c12f23508a..8cca59df33846 100644 --- a/src/librustc_span/lib.rs +++ b/src/librustc_span/lib.rs @@ -1052,7 +1052,7 @@ impl Decodable for SourceFile { name_was_remapped, unmapped_path: None, // `crate_of_origin` has to be set by the importer. - // This value matches up with `rustc::hir::def_id::INVALID_CRATE`. + // This value matches up with `rustc_hir::def_id::INVALID_CRATE`. // That constant is not available here, unfortunately. crate_of_origin: std::u32::MAX - 1, start_pos, diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index 979587f7ac394..2cb25e63f836d 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -12,6 +12,7 @@ path = "lib.rs" log = { version = "0.4" } rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_hir = { path = "../librustc_hir" } rustc_macros = { path = "../librustc_macros" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } diff --git a/src/librustc_traits/chalk_context/program_clauses/builtin.rs b/src/librustc_traits/chalk_context/program_clauses/builtin.rs index b3983be0e1a51..7512cbbd88218 100644 --- a/src/librustc_traits/chalk_context/program_clauses/builtin.rs +++ b/src/librustc_traits/chalk_context/program_clauses/builtin.rs @@ -1,10 +1,10 @@ use crate::generic_types; use crate::lowering::Lower; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::traits::{Clause, GoalKind, ProgramClause, ProgramClauseCategory}; use rustc::ty::subst::{GenericArg, InternalSubsts, Subst}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; /// Returns a predicate of the form /// `Implemented(ty: Trait) :- Implemented(nested: Trait)...` diff --git a/src/librustc_traits/chalk_context/program_clauses/mod.rs b/src/librustc_traits/chalk_context/program_clauses/mod.rs index 0504602dac979..38a4a72964843 100644 --- a/src/librustc_traits/chalk_context/program_clauses/mod.rs +++ b/src/librustc_traits/chalk_context/program_clauses/mod.rs @@ -2,11 +2,11 @@ mod builtin; mod primitive; use super::ChalkInferenceContext; -use rustc::hir::def_id::DefId; use rustc::traits::{ Clause, DomainGoal, Environment, FromEnv, ProgramClause, ProgramClauseCategory, WellFormed, }; use rustc::ty::{self, TyCtxt}; +use rustc_hir::def_id::DefId; use std::iter; use self::builtin::*; diff --git a/src/librustc_traits/chalk_context/program_clauses/primitive.rs b/src/librustc_traits/chalk_context/program_clauses/primitive.rs index 498a7334dc9a6..ae4afe58436d6 100644 --- a/src/librustc_traits/chalk_context/program_clauses/primitive.rs +++ b/src/librustc_traits/chalk_context/program_clauses/primitive.rs @@ -1,11 +1,11 @@ use crate::generic_types; use crate::lowering::Lower; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::traits::{ Clause, Clauses, DomainGoal, GoalKind, ProgramClause, ProgramClauseCategory, WellFormed, }; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_target::spec::abi; use std::iter; diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index a0bbc2824336c..bc4d03cca7fee 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -1,4 +1,3 @@ -use rustc::hir::def_id::DefId; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::traits::query::dropck_outlives::trivial_dropck_outlives; use rustc::traits::query::dropck_outlives::{DropckOutlivesResult, DtorckConstraint}; @@ -8,6 +7,7 @@ use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def_id::DefId; use rustc_span::source_map::{Span, DUMMY_SP}; crate fn provide(p: &mut Providers<'_>) { diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index a48468a5851e1..e1a9ec56f8ba5 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -1,9 +1,9 @@ //! Utilities for creating generic types with bound vars in place of parameter values. -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::ty::subst::{GenericArg, InternalSubsts, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_target::spec::abi; crate fn bound(tcx: TyCtxt<'tcx>, index: u32) -> Ty<'tcx> { diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index a58ec5bab5e98..0e959cecaa9bb 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -1,7 +1,6 @@ //! Provider for the `implied_outlives_bounds` query. //! Do not call this query directory. See [`rustc::traits::query::implied_outlives_bounds`]. -use rustc::hir; use rustc::infer::canonical::{self, Canonical}; use rustc::infer::InferCtxt; use rustc::traits::query::outlives_bounds::OutlivesBound; @@ -12,6 +11,7 @@ use rustc::ty::outlives::Component; use rustc::ty::query::Providers; use rustc::ty::wf; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc_hir as hir; use rustc_span::source_map::DUMMY_SP; use smallvec::{smallvec, SmallVec}; diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index c7e519a0c3dcf..315efe5cf71e7 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -1,9 +1,9 @@ -use rustc::hir::def_id::DefId; use rustc::traits::{ Clause, Clauses, DomainGoal, Environment, FromEnv, ProgramClause, ProgramClauseCategory, }; use rustc::ty::{self, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def_id::DefId; struct ClauseVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, @@ -151,7 +151,7 @@ crate fn program_clauses_for_env<'tcx>( crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> { use super::{IntoFromEnvGoal, Lower}; - use rustc::hir::{ForeignItemKind, ImplItemKind, ItemKind, Node, TraitItemKind}; + use rustc_hir::{ForeignItemKind, ImplItemKind, ItemKind, Node, TraitItemKind}; debug!("environment(def_id = {:?})", def_id); diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index d23c7013b5f87..47009ac41232f 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -1,8 +1,5 @@ mod environment; -use rustc::hir; -use rustc::hir::def::DefKind; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::hir::map::definitions::DefPathData; use rustc::traits::{ @@ -12,6 +9,9 @@ use rustc::traits::{ use rustc::ty::query::Providers; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, List, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def::DefKind; +use rustc_hir::def_id::DefId; use rustc_span::symbol::sym; use syntax::ast; diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index 6b539b8993160..e50ca485e0a6a 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -1,9 +1,9 @@ -use rustc::hir; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::traits::query::{normalize::NormalizationResult, CanonicalProjectionGoal, NoSolution}; use rustc::traits::{self, ObligationCause, SelectionContext, TraitEngineExt}; use rustc::ty::query::Providers; use rustc::ty::{ParamEnvAnd, TyCtxt}; +use rustc_hir as hir; use rustc_span::DUMMY_SP; use std::sync::atomic::Ordering; diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index 6357df6d6e9c6..149c42e9c5eb1 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -1,5 +1,3 @@ -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::infer::at::ToTrace; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::infer::InferCtxt; @@ -15,6 +13,8 @@ use rustc::ty::subst::{GenericArg, Subst, UserSelfTy, UserSubsts}; use rustc::ty::{ FnSig, Lift, ParamEnv, ParamEnvAnd, PolyFnSig, Predicate, Ty, TyCtxt, TypeFoldable, Variance, }; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::DUMMY_SP; use std::fmt; diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index 167ba8458936a..a489d0cd02b40 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -15,6 +15,7 @@ arena = { path = "../libarena" } log = "0.4" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } +rustc_hir = { path = "../librustc_hir" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 601a46ad345c4..36d119bf7698f 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -3,11 +3,6 @@ //! instance of `AstConv`. use crate::collect::PlaceholderHirTyCollector; -use crate::hir::def::{CtorOf, DefKind, Res}; -use crate::hir::def_id::DefId; -use crate::hir::intravisit::Visitor; -use crate::hir::print; -use crate::hir::{self, ExprKind, GenericArg, GenericArgs}; use crate::lint; use crate::middle::lang_items::SizedTraitLangItem; use crate::middle::resolve_lifetime as rl; @@ -15,6 +10,7 @@ use crate::namespace::Namespace; use crate::require_c_abi_if_c_variadic; use crate::util::common::ErrorReported; use errors::{Applicability, DiagnosticId}; +use rustc::hir::intravisit::Visitor; use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef}; @@ -22,6 +18,11 @@ use rustc::ty::wf::object_region_bounds; use rustc::ty::{self, Const, DefIdTree, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{CtorOf, DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::print; +use rustc_hir::{ExprKind, GenericArg, GenericArgs}; use rustc_span::symbol::sym; use rustc_span::{MultiSpan, Span, DUMMY_SP}; use rustc_target::spec::abi; @@ -2554,12 +2555,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { assert_eq!(opt_self_ty, None); self.prohibit_generics(path.segments); match prim_ty { - hir::Bool => tcx.types.bool, - hir::Char => tcx.types.char, - hir::Int(it) => tcx.mk_mach_int(it), - hir::Uint(uit) => tcx.mk_mach_uint(uit), - hir::Float(ft) => tcx.mk_mach_float(ft), - hir::Str => tcx.mk_str(), + hir::PrimTy::Bool => tcx.types.bool, + hir::PrimTy::Char => tcx.types.char, + hir::PrimTy::Int(it) => tcx.mk_mach_int(it), + hir::PrimTy::Uint(uit) => tcx.mk_mach_uint(uit), + hir::PrimTy::Float(ft) => tcx.mk_mach_float(ft), + hir::PrimTy::Str => tcx.mk_str(), } } Res::Err => { @@ -2773,11 +2774,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } let input_tys = decl.inputs.iter().map(|a| self.ty_of_arg(a, None)); let output_ty = match decl.output { - hir::Return(ref output) => { + hir::FunctionRetTy::Return(ref output) => { visitor.visit_ty(output); self.ast_ty_to_ty(output) } - hir::DefaultReturn(..) => tcx.mk_unit(), + hir::FunctionRetTy::DefaultReturn(..) => tcx.mk_unit(), }; debug!("ty_of_fn: output_ty={:?}", output_ty); diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 4c0ef45cae5c5..58e0bec1842f2 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -1,10 +1,11 @@ use crate::check::coercion::CoerceMany; use crate::check::{Diverges, Expectation, FnCtxt, Needs}; -use rustc::hir::{self, ExprKind}; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::ObligationCauseCode; use rustc::traits::{IfExpressionCause, MatchExpressionArmCause, ObligationCause}; use rustc::ty::Ty; +use rustc_hir as hir; +use rustc_hir::ExprKind; use rustc_span::Span; impl<'a, 'tcx> FnCtxt<'a, 'tcx> { @@ -219,7 +220,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &self, span: Span, then_expr: &'tcx hir::Expr<'tcx>, - coercion: &mut CoerceMany<'tcx, '_, rustc::hir::Arm<'tcx>>, + coercion: &mut CoerceMany<'tcx, '_, rustc_hir::Arm<'tcx>>, ) -> bool { // If this `if` expr is the parent's function return expr, // the cause of the type coercion is the return type, point at it. (#25228) diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 45c9922c579ce..3b4f408b8aae8 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -1,13 +1,13 @@ use super::method::MethodCallee; use super::{FnCtxt, Needs, PlaceOp}; -use rustc::hir; use rustc::infer::{InferCtxt, InferOk}; use rustc::session::DiagnosticMessageId; use rustc::traits::{self, TraitEngine}; use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref}; use rustc::ty::{self, TraitRef, Ty, TyCtxt}; use rustc::ty::{ToPredicate, TypeFoldable}; +use rustc_hir as hir; use rustc_span::Span; use syntax::ast::Ident; diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 4b6bb2e05bfaa..23db0fc463dae 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -14,7 +14,7 @@ use rustc_span::Span; use rustc_target::spec::abi; use syntax::ast::Ident; -use rustc::hir; +use rustc_hir as hir; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 445a723e3cb7d..332921f45f4d5 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -34,7 +34,6 @@ use crate::hir::def_id::DefId; use crate::lint; use crate::util::common::ErrorReported; use errors::{Applicability, DiagnosticBuilder}; -use rustc::hir; use rustc::middle::lang_items; use rustc::session::Session; use rustc::traits; @@ -43,6 +42,7 @@ use rustc::ty::cast::{CastKind, CastTy}; use rustc::ty::error::TypeError; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut, TypeFoldable}; +use rustc_hir as hir; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 8bff95cd49740..6bb7f4995b6ec 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -4,8 +4,6 @@ use super::{check_fn, Expectation, FnCtxt, GeneratorTypes}; use crate::astconv::AstConv; use crate::middle::{lang_items, region}; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::infer::LateBoundRegionConversionTime; use rustc::infer::{InferOk, InferResult}; @@ -14,6 +12,8 @@ use rustc::traits::Obligation; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, GenericParamDefKind, Ty}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span::source_map::Span; use rustc_target::spec::abi::Abi; use std::cmp; @@ -548,8 +548,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // First, convert the types that the user supplied (if any). let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a)); let supplied_return = match decl.output { - hir::Return(ref output) => astconv.ast_ty_to_ty(&output), - hir::DefaultReturn(_) => match body.generator_kind { + hir::FunctionRetTy::Return(ref output) => astconv.ast_ty_to_ty(&output), + hir::FunctionRetTy::DefaultReturn(_) => match body.generator_kind { // In the case of the async block that we create for a function body, // we expect the return type of the block to match that of the enclosing // function. @@ -696,7 +696,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.types.err }); - if let hir::Return(ref output) = decl.output { + if let hir::FunctionRetTy::Return(ref output) = decl.output { astconv.ast_ty_to_ty(&output); } diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index f9cc86b85095c..68cbd73a8aa9b 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -52,8 +52,6 @@ use crate::check::{FnCtxt, Needs}; use errors::DiagnosticBuilder; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::infer::{Coercion, InferOk, InferResult}; use rustc::traits::{self, ObligationCause, ObligationCauseCode}; @@ -65,6 +63,8 @@ use rustc::ty::fold::TypeFoldable; use rustc::ty::relate::RelateResult; use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TypeAndMut}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_span; use rustc_span::symbol::sym; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index d6ef3889ee83d..13e37c124e014 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -1,6 +1,5 @@ use errors::{Applicability, DiagnosticId}; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::{self, GenericParamKind, ImplItemKind, TraitItemKind}; +use rustc::hir::intravisit; use rustc::infer::{self, InferOk}; use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; @@ -8,7 +7,9 @@ use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::util::ExplicitSelf; use rustc::ty::{self, GenericParamDefKind, TyCtxt}; use rustc::util::common::ErrorReported; - +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::{GenericParamKind, ImplItemKind, TraitItemKind}; use rustc_span::Span; use syntax::errors::pluralize; @@ -877,9 +878,9 @@ fn compare_synthetic_generics<'tcx>( _ => unreachable!(), }; struct Visitor(Option, hir::def_id::DefId); - impl<'v> hir::intravisit::Visitor<'v> for Visitor { + impl<'v> intravisit::Visitor<'v> for Visitor { fn visit_ty(&mut self, ty: &'v hir::Ty<'v>) { - hir::intravisit::walk_ty(self, ty); + intravisit::walk_ty(self, ty); if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ty.kind { @@ -892,14 +893,14 @@ fn compare_synthetic_generics<'tcx>( } fn nested_visit_map<'this>( &'this mut self, - ) -> hir::intravisit::NestedVisitorMap<'this, 'v> + ) -> intravisit::NestedVisitorMap<'this, 'v> { - hir::intravisit::NestedVisitorMap::None + intravisit::NestedVisitorMap::None } } let mut visitor = Visitor(None, impl_def_id); for ty in input_tys { - hir::intravisit::Visitor::visit_ty(&mut visitor, ty); + intravisit::Visitor::visit_ty(&mut visitor, ty); } let span = visitor.0?; diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 104321bcb79b0..1be65b5f1894b 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -3,9 +3,10 @@ use rustc::infer::InferOk; use rustc::traits::{self, ObligationCause}; use errors::{Applicability, DiagnosticBuilder}; -use rustc::hir::{self, is_range_literal, print, Node}; use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::{self, AssocItem, Ty}; +use rustc_hir as hir; +use rustc_hir::{is_range_literal, print, Node}; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::util::parser::PREC_POSTFIX; diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 743a2c6b54397..c12d8400f0863 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -17,10 +17,6 @@ use crate::check::TupleArgumentsFlag::DontTupleArguments; use crate::util::common::ErrorReported; use errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId}; -use rustc::hir; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::def_id::DefId; -use rustc::hir::{ExprKind, QPath}; use rustc::infer; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::middle::lang_items; @@ -31,6 +27,10 @@ use rustc::ty::Ty; use rustc::ty::TypeFoldable; use rustc::ty::{AdtKind, Visibility}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::{ExprKind, QPath}; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::Span; use rustc_span::symbol::{kw, sym, Symbol}; @@ -306,11 +306,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> Ty<'tcx> { let tcx = self.tcx; let expected_inner = match unop { - hir::UnNot | hir::UnNeg => expected, - hir::UnDeref => NoExpectation, + hir::UnOp::UnNot | hir::UnOp::UnNeg => expected, + hir::UnOp::UnDeref => NoExpectation, }; let needs = match unop { - hir::UnDeref => needs, + hir::UnOp::UnDeref => needs, _ => Needs::None, }; let mut oprnd_t = self.check_expr_with_expectation_and_needs(&oprnd, expected_inner, needs); @@ -318,7 +318,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !oprnd_t.references_error() { oprnd_t = self.structurally_resolved_type(expr.span, oprnd_t); match unop { - hir::UnDeref => { + hir::UnOp::UnDeref => { if let Some(mt) = oprnd_t.builtin_deref(true) { oprnd_t = mt.ty; } else if let Some(ok) = self.try_overloaded_deref(expr.span, oprnd_t, needs) { @@ -362,14 +362,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { oprnd_t = tcx.types.err; } } - hir::UnNot => { + hir::UnOp::UnNot => { let result = self.check_user_unop(expr, oprnd_t, unop); // If it's builtin, we can reuse the type, this helps inference. if !(oprnd_t.is_integral() || oprnd_t.kind == ty::Bool) { oprnd_t = result; } } - hir::UnNeg => { + hir::UnOp::UnNeg => { let result = self.check_user_unop(expr, oprnd_t, unop); // If it's builtin, we can reuse the type, this helps inference. if !oprnd_t.is_numeric() { diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index 63aadd43a0949..f004d04fdfeba 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -4,13 +4,14 @@ //! types computed here. use super::FnCtxt; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::{self, Expr, ExprKind, Pat, PatKind}; use rustc::middle::region::{self, YieldData}; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::{Expr, ExprKind, Pat, PatKind}; use rustc_span::Span; struct InteriorVisitor<'a, 'tcx> { diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index ce8edd70eb684..a267b9786f1d8 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -9,7 +9,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc_span::symbol::Symbol; use rustc_target::spec::abi::Abi; -use rustc::hir; +use rustc_hir as hir; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 0f4d7e24df029..83890cfce670c 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -4,7 +4,6 @@ use crate::astconv::AstConv; use crate::check::{callee, FnCtxt, Needs, PlaceOp}; use crate::hir::def_id::DefId; use crate::hir::GenericArg; -use rustc::hir; use rustc::infer::{self, InferOk}; use rustc::traits; use rustc::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCast}; @@ -12,6 +11,7 @@ use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, GenericParamDefKind, Ty}; +use rustc_hir as hir; use rustc_span::Span; use std::ops::Deref; @@ -425,7 +425,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { match exprs.last().unwrap().kind { hir::ExprKind::Field(ref expr, _) | hir::ExprKind::Index(ref expr, _) - | hir::ExprKind::Unary(hir::UnDeref, ref expr) => exprs.push(&expr), + | hir::ExprKind::Unary(hir::UnOp::UnDeref, ref expr) => exprs.push(&expr), _ => break, } } @@ -471,7 +471,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { &[index_expr_ty], ); } - hir::ExprKind::Unary(hir::UnDeref, ref base_expr) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base_expr) => { self.convert_place_op_to_mutable(PlaceOp::Deref, expr, base_expr, &[]); } _ => {} diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index fe168b7ddbc47..e9356a04c01d4 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -13,9 +13,6 @@ pub use self::MethodError::*; use crate::check::FnCtxt; use crate::namespace::Namespace; use errors::{Applicability, DiagnosticBuilder}; -use rustc::hir; -use rustc::hir::def::{CtorOf, DefKind}; -use rustc::hir::def_id::DefId; use rustc::infer::{self, InferOk}; use rustc::traits; use rustc::ty::subst::Subst; @@ -23,6 +20,9 @@ use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::GenericParamDefKind; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TypeFoldable}; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def::{CtorOf, DefKind}; +use rustc_hir::def_id::DefId; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 28c84c5c0d022..50f22eabf62c2 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -9,7 +9,6 @@ use crate::hir::def::DefKind; use crate::hir::def_id::DefId; use crate::namespace::Namespace; -use rustc::hir; use rustc::infer::canonical::OriginalQueryValues; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; @@ -29,6 +28,7 @@ use rustc::ty::{ }; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; use rustc_span::{symbol::Symbol, Span, DUMMY_SP}; use std::cmp::max; use std::iter; diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index fd92e376f61c1..1cc1eb2c7b2df 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -5,15 +5,17 @@ use crate::check::FnCtxt; use crate::middle::lang_items::FnOnceTraitLangItem; use crate::namespace::Namespace; use errors::{pluralize, Applicability, DiagnosticBuilder}; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc::hir::intravisit; use rustc::hir::map as hir_map; -use rustc::hir::{self, ExprKind, Node, QPath}; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::Obligation; use rustc::ty::print::with_crate_prefix; use rustc::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::{ExprKind, Node, QPath}; use rustc_span::{source_map, FileName, Span}; use syntax::ast; use syntax::util::lev_distance; @@ -1073,18 +1075,18 @@ impl UsePlacementFinder<'tcx> { target_module: hir::HirId, ) -> (Option, bool) { let mut finder = UsePlacementFinder { target_module, span: None, found_use: false, tcx }; - hir::intravisit::walk_crate(&mut finder, krate); + intravisit::walk_crate(&mut finder, krate); (finder.span, finder.found_use) } } -impl hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> { +impl intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> { fn visit_mod(&mut self, module: &'tcx hir::Mod<'tcx>, _: Span, hir_id: hir::HirId) { if self.span.is_some() { return; } if hir_id != self.target_module { - hir::intravisit::walk_mod(self, module, hir_id); + intravisit::walk_mod(self, module, hir_id); return; } // Find a `use` statement. @@ -1124,8 +1126,8 @@ impl hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'tcx> { } } - fn nested_visit_map<'this>(&'this mut self) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> { - hir::intravisit::NestedVisitorMap::None + fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { + intravisit::NestedVisitorMap::None } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 312208626cf2d..eacd94f7da7f7 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -91,11 +91,7 @@ use crate::astconv::{AstConv, PathSeg}; use crate::middle::lang_items; use crate::namespace::Namespace; use errors::{pluralize, Applicability, DiagnosticBuilder, DiagnosticId}; -use rustc::hir::def::{CtorOf, DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LOCAL_CRATE}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::{self, ExprKind, GenericArg, HirIdMap, ItemKind, Node, PatKind, QPath}; use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse}; use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282; use rustc::infer::opaque_types::OpaqueTypeDecl; @@ -118,6 +114,11 @@ use rustc::ty::{ ToPredicate, Ty, TyCtxt, UserType, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{CtorOf, DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::{ExprKind, GenericArg, HirIdMap, ItemKind, Node, PatKind, QPath}; use rustc_index::vec::Idx; use rustc_span::hygiene::DesugaringKind; use rustc_span::source_map::{original_sp, DUMMY_SP}; @@ -390,6 +391,7 @@ impl UnsafetyState { } pub fn recurse(&mut self, blk: &hir::Block<'_>) -> UnsafetyState { + use hir::BlockCheckMode; match self.unsafety { // If this unsafe, then if the outer function was already marked as // unsafe we shouldn't attribute the unsafe'ness to the block. This @@ -399,16 +401,16 @@ impl UnsafetyState { unsafety => { let (unsafety, def, count) = match blk.rules { - hir::PushUnsafeBlock(..) => { + BlockCheckMode::PushUnsafeBlock(..) => { (unsafety, blk.hir_id, self.unsafe_push_count.checked_add(1).unwrap()) } - hir::PopUnsafeBlock(..) => { + BlockCheckMode::PopUnsafeBlock(..) => { (unsafety, blk.hir_id, self.unsafe_push_count.checked_sub(1).unwrap()) } - hir::UnsafeBlock(..) => { + BlockCheckMode::UnsafeBlock(..) => { (hir::Unsafety::Unsafe, blk.hir_id, self.unsafe_push_count) } - hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), + BlockCheckMode::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), }; UnsafetyState { def, unsafety, unsafe_push_count: count, from_fn: false } } diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index e0035c4afc7cc..691469e48835a 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -3,11 +3,11 @@ use super::method::MethodCallee; use super::{FnCtxt, Needs}; use errors::{self, Applicability}; -use rustc::hir; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::TyKind::{Adt, Array, Char, FnDef, Never, Ref, Str, Tuple, Uint}; use rustc::ty::{self, Ty, TypeFoldable}; +use rustc_hir as hir; use rustc_span::Span; use syntax::ast::Ident; @@ -689,16 +689,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ), ); match actual.kind { - Uint(_) if op == hir::UnNeg => { + Uint(_) if op == hir::UnOp::UnNeg => { err.note("unsigned values cannot be negated"); } Str | Never | Char | Tuple(_) | Array(_, _) => {} Ref(_, ref lty, _) if lty.kind == Str => {} _ => { let missing_trait = match op { - hir::UnNeg => "std::ops::Neg", - hir::UnNot => "std::ops::Not", - hir::UnDeref => "std::ops::UnDerf", + hir::UnOp::UnNeg => "std::ops::Neg", + hir::UnOp::UnNot => "std::ops::Not", + hir::UnOp::UnDeref => "std::ops::UnDerf", }; err.note(&format!( "an implementation of `{}` might \ @@ -771,9 +771,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span_bug!(span, "&& and || are not overloadable") } } - } else if let Op::Unary(hir::UnNot, _) = op { + } else if let Op::Unary(hir::UnOp::UnNot, _) = op { ("not", lang.not_trait()) - } else if let Op::Unary(hir::UnNeg, _) = op { + } else if let Op::Unary(hir::UnOp::UnNeg, _) = op { ("neg", lang.neg_trait()) } else { bug!("lookup_op_method: op not supported: {:?}", op) diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 8e5e5c39e67dc..051bf61c90a8c 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -1,14 +1,15 @@ use crate::check::FnCtxt; use errors::{pluralize, Applicability, DiagnosticBuilder}; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::pat_util::EnumerateAndAdjustIterator; -use rustc::hir::{self, HirId, Pat, PatKind}; use rustc::infer; use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc::traits::Pattern; use rustc::ty::subst::GenericArg; use rustc::ty::{self, BindingMode, Ty, TypeFoldable}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::pat_util::EnumerateAndAdjustIterator; +use rustc_hir::{HirId, Pat, PatKind}; use rustc_span::hygiene::DesugaringKind; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 90d8d0623a75b..3b2f3d17e8da6 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -76,15 +76,15 @@ use crate::check::dropck; use crate::check::FnCtxt; use crate::mem_categorization as mc; use crate::middle::region; -use rustc::hir::def_id::DefId; +use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, RegionObligation, SuppressRegionErrors}; use rustc::ty::adjustment; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, Ty}; - -use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::{self, PatKind}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::PatKind; use rustc_span::Span; use std::mem; use std::ops::Deref; @@ -492,7 +492,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> { if is_method_call { let origin = match expr.kind { hir::ExprKind::MethodCall(..) => infer::ParameterOrigin::MethodCall, - hir::ExprKind::Unary(op, _) if op == hir::UnDeref => { + hir::ExprKind::Unary(op, _) if op == hir::UnOp::UnDeref => { infer::ParameterOrigin::OverloadedDeref } _ => infer::ParameterOrigin::OverloadedOperator, @@ -577,7 +577,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionCtxt<'a, 'tcx> { intravisit::walk_expr(self, expr); } - hir::ExprKind::Unary(hir::UnDeref, ref base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => { // For *a, the lifetime of a must enclose the deref if is_method_call { self.constrain_call(expr, Some(base), None::>.iter()); diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 4376f9b6fa4a8..be912b6bcafc0 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -35,13 +35,13 @@ use super::FnCtxt; use crate::expr_use_visitor as euv; use crate::mem_categorization as mc; use crate::mem_categorization::PlaceBase; -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::def_id::LocalDefId; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::UpvarRegion; use rustc::ty::{self, Ty, TyCtxt, UpvarSubsts}; use rustc_data_structures::fx::FxIndexMap; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::def_id::LocalDefId; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index e9df155c9b758..2da27d59829cf 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1,14 +1,14 @@ use crate::check::{FnCtxt, Inherited}; use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter}; -use rustc::hir::def_id::DefId; -use rustc::hir::ItemKind; use rustc::infer::opaque_types::may_define_opaque_type; use rustc::middle::lang_items; use rustc::traits::{self, ObligationCause, ObligationCauseCode}; use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::ty::{self, AdtKind, GenericParamDefKind, ToPredicate, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def_id::DefId; +use rustc_hir::ItemKind; use errors::DiagnosticBuilder; use rustc_span::symbol::sym; @@ -16,8 +16,8 @@ use rustc_span::Span; use syntax::ast; use syntax::feature_gate; -use rustc::hir; -use rustc::hir::itemlikevisit::ParItemLikeVisitor; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ParItemLikeVisitor; use rustc_error_codes::*; diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 0fbc14a717374..ad9a2f2e2b45e 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -4,8 +4,6 @@ use crate::check::FnCtxt; -use rustc::hir; -use rustc::hir::def_id::{DefId, DefIdSet, DefIndex}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::infer::error_reporting::TypeAnnotationNeeded::E0282; use rustc::infer::InferCtxt; @@ -13,6 +11,8 @@ use rustc::ty::adjustment::{Adjust, Adjustment, PointerCast}; use rustc::ty::fold::{TypeFoldable, TypeFolder}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_data_structures::sync::Lrc; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIdSet, DefIndex}; use rustc_span::symbol::sym; use rustc_span::Span; @@ -133,8 +133,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { // operating on scalars, we clear the overload. fn fix_scalar_builtin_expr(&mut self, e: &hir::Expr<'_>) { match e.kind { - hir::ExprKind::Unary(hir::UnNeg, ref inner) - | hir::ExprKind::Unary(hir::UnNot, ref inner) => { + hir::ExprKind::Unary(hir::UnOp::UnNeg, ref inner) + | hir::ExprKind::Unary(hir::UnOp::UnNot, ref inner) => { let inner_ty = self.fcx.node_ty(inner.hir_id); let inner_ty = self.fcx.resolve_vars_if_possible(&inner_ty); diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index b0cbabd195853..ab8e4ce6975a9 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -5,11 +5,11 @@ use errors::Applicability; use rustc_span::Span; use syntax::ast; -use rustc::hir; -use rustc::hir::def_id::{DefId, DefIdSet, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::print::visibility_qualified; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::print::visibility_qualified; pub fn check_crate(tcx: TyCtxt<'_>) { let mut used_trait_imports = DefIdSet::default(); diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 7e016cf7e9a95..6d97661e5272a 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -13,8 +13,9 @@ use rustc::ty::util::CopyImplementationError; use rustc::ty::TypeFoldable; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, ItemKind}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::ItemKind; use rustc_error_codes::*; diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 4e75134a04cfd..76de177e8e510 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -7,10 +7,10 @@ //! `tcx.inherent_impls(def_id)`). That value, however, //! is computed by selecting an idea from this table. -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::{self, CrateInherentImpls, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::Span; use syntax::ast; diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index 76eb8f5379c0e..fed8ed53468d6 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -1,9 +1,9 @@ use crate::namespace::Namespace; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_error_codes::*; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index b387a5d152017..8a87bcabeecdf 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -1,10 +1,10 @@ //! Orphan checker: every impl either implements a trait defined in this //! crate or pertains to a type defined in this crate. -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_error_codes::*; diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index eee292c55a8a4..ed0d9ba643a31 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -1,9 +1,10 @@ //! Unsafety checker: every impl either implements a trait defined in this //! crate or pertains to a type defined in this crate. -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::{self, Unsafety}; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::Unsafety; use rustc_error_codes::*; diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index bc39856e14d73..1fefeaf720fcc 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -20,6 +20,7 @@ use crate::constrained_generic_params as cgp; use crate::lint; use crate::middle::resolve_lifetime as rl; use crate::middle::weak_lang_items; +use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc::mir::mono::Linkage; use rustc::ty::query::Providers; @@ -31,22 +32,18 @@ use rustc::ty::{self, AdtKind, Const, DefIdTree, ToPolyTraitRef, Ty, TyCtxt}; use rustc::ty::{ReprOptions, ToPredicate}; use rustc::util::captures::Captures; use rustc_data_structures::fx::FxHashMap; -use rustc_target::spec::abi; - +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::{GenericParamKind, Node, Unsafety}; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::{Span, DUMMY_SP}; +use rustc_target::spec::abi; use syntax::ast; use syntax::ast::{Ident, MetaItemKind}; use syntax::attr::{list_contains_name, mark_used, InlineAttr, OptimizeAttr}; use syntax::feature_gate; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::GenericParamKind; -use rustc::hir::Node; -use rustc::hir::{self, Unsafety}; - use errors::{Applicability, StashKey}; use rustc_error_codes::*; @@ -114,7 +111,7 @@ impl<'v> Visitor<'v> for PlaceholderHirTyCollector { if let hir::TyKind::Infer = t.kind { self.0.push(t.span); } - hir::intravisit::walk_ty(self, t) + intravisit::walk_ty(self, t) } } @@ -353,7 +350,7 @@ fn type_param_predicates( tcx: TyCtxt<'_>, (item_def_id, def_id): (DefId, DefId), ) -> ty::GenericPredicates<'_> { - use rustc::hir::*; + use rustc_hir::*; // In the AST, bounds can derive from two places. Either // written inline like `` or in a where-clause like @@ -712,7 +709,7 @@ fn convert_variant( } fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef { - use rustc::hir::*; + use rustc_hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = match tcx.hir().get(hir_id) { @@ -992,7 +989,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option, def_id: DefId) -> &ty::Generics { - use rustc::hir::*; + use rustc_hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1260,7 +1257,7 @@ fn infer_placeholder_type( } fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { - use rustc::hir::*; + use rustc_hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1562,7 +1559,7 @@ fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { } fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { - use rustc::hir::{ImplItem, Item, TraitItem}; + use rustc_hir::{ImplItem, Item, TraitItem}; debug!("find_opaque_ty_constraints({:?})", def_id); @@ -1811,8 +1808,8 @@ pub fn get_infer_ret_ty(output: &'hir hir::FunctionRetTy<'hir>) -> Option<&'hir } fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> { - use rustc::hir::Node::*; - use rustc::hir::*; + use rustc_hir::Node::*; + use rustc_hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -2029,8 +2026,8 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> { /// Returns a list of user-specified type predicates for the definition with ID `def_id`. /// N.B., this does not include any implied/inferred constraints. fn explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> { - use rustc::hir::*; use rustc_data_structures::fx::FxHashSet; + use rustc_hir::*; debug!("explicit_predicates_of(def_id={:?})", def_id); @@ -2499,7 +2496,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>( for (input, ty) in decl.inputs.iter().zip(*fty.inputs().skip_binder()) { check(&input, ty) } - if let hir::Return(ref ty) = decl.output { + if let hir::FunctionRetTy::Return(ref ty) = decl.output { check(&ty, *fty.output().skip_binder()) } } diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs index 030b8a6214948..be00c57763a4e 100644 --- a/src/librustc_typeck/expr_use_visitor.rs +++ b/src/librustc_typeck/expr_use_visitor.rs @@ -8,11 +8,12 @@ use self::OverloadedCallType::*; // Export these here so that Clippy can use them. pub use mc::{Place, PlaceBase, Projection}; -use rustc::hir::def::Res; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, PatKind}; use rustc::infer::InferCtxt; use rustc::ty::{self, adjustment, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def::Res; +use rustc_hir::def_id::DefId; +use rustc_hir::PatKind; use crate::mem_categorization as mc; use rustc_span::Span; @@ -192,7 +193,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { hir::ExprKind::Type(ref subexpr, _) => self.walk_expr(subexpr), - hir::ExprKind::Unary(hir::UnDeref, ref base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref base) => { // *base self.select_from_expr(base); } diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 770aeb6869a8a..d099a739ac46a 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -9,12 +9,12 @@ //! fixed, but for the moment it's easier to do these checks early. use crate::constrained_generic_params as cgp; -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt, TypeFoldable}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use std::collections::hash_map::Entry::{Occupied, Vacant}; use rustc_span::Span; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index dbf4c7655c14b..8fba65db30981 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -93,8 +93,6 @@ mod outlives; mod structured_errors; mod variance; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::{self, Node}; use rustc::infer::InferOk; use rustc::lint; use rustc::middle; @@ -106,6 +104,9 @@ use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::util; use rustc::util::common::ErrorReported; +use rustc_hir as hir; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::Node; use rustc_span::{Span, DUMMY_SP}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc_typeck/mem_categorization.rs b/src/librustc_typeck/mem_categorization.rs index 4c5e7c81b27ff..d3d0aa2e5807f 100644 --- a/src/librustc_typeck/mem_categorization.rs +++ b/src/librustc_typeck/mem_categorization.rs @@ -48,18 +48,16 @@ //! result of `*x'`, effectively, where `x'` is a `Categorization::Upvar` reference //! tied to `x`. The type of `x'` will be a borrowed pointer. -use rustc::hir; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::DefId; -use rustc::hir::PatKind; use rustc::infer::InferCtxt; use rustc::ty::adjustment; use rustc::ty::fold::TypeFoldable; use rustc::ty::{self, Ty, TyCtxt}; - -use rustc_span::Span; - use rustc_data_structures::fx::FxIndexMap; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::PatKind; +use rustc_span::Span; #[derive(Clone, Debug)] pub enum PlaceBase { @@ -347,7 +345,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { let expr_ty = self.expr_ty(expr)?; match expr.kind { - hir::ExprKind::Unary(hir::UnDeref, ref e_base) => { + hir::ExprKind::Unary(hir::UnOp::UnDeref, ref e_base) => { if self.tables.is_method_call(expr) { self.cat_overloaded_place(expr, e_base) } else { diff --git a/src/librustc_typeck/namespace.rs b/src/librustc_typeck/namespace.rs index 0d672f267db84..2aa97aa7e6f0b 100644 --- a/src/librustc_typeck/namespace.rs +++ b/src/librustc_typeck/namespace.rs @@ -1,5 +1,5 @@ -use rustc::hir; use rustc::ty; +use rustc_hir as hir; // Whether an item exists in the type or value namespace. #[derive(Copy, Clone, PartialEq, Eq, Debug)] diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index a922846856db8..7500c39cf216b 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -1,6 +1,6 @@ -use rustc::hir::def_id::DefId; use rustc::ty::{self, OutlivesPredicate, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::DefId; use super::utils::*; diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index b18f89c1a72d1..1645f01a4b195 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -1,9 +1,10 @@ -use rustc::hir::def_id::DefId; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::{self, Node}; use rustc::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc::ty::{self, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashMap; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::Node; use rustc_span::Span; use super::explicit::ExplicitPredicatesMap; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 992781e3bcbeb..519873910976b 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -1,9 +1,9 @@ use hir::Node; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::subst::GenericArgKind; use rustc::ty::{self, CratePredicatesMap, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc_span::symbol::sym; use rustc_span::Span; diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index f29d2d8f42448..f8907c85218ee 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -1,6 +1,6 @@ -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 8fac3a473a51b..5ca961ed34424 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -4,10 +4,10 @@ //! We walk the set of items and, for each member, generate new constraints. use hir::def_id::DefId; -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use super::terms::VarianceTerm::*; use super::terms::*; diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index 7449ff10daa59..27dc03bbbe206 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -5,10 +5,10 @@ use arena; use hir::Node; -use rustc::hir; -use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::ty::query::Providers; use rustc::ty::{self, CrateVariancesMap, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; /// Defines the `TermsContext` basically houses an arena where we can /// allocate terms. diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index ce5115ffbba75..e285f44123af9 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -5,9 +5,9 @@ //! optimal solution to the constraints. The final variance for each //! inferred is then written into the `variance_map` in the tcx. -use rustc::hir::def_id::DefId; use rustc::ty; use rustc_data_structures::fx::FxHashMap; +use rustc_hir::def_id::DefId; use super::constraints::*; use super::terms::VarianceTerm::*; diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index db3e7a2b13428..dd593a6abb4fe 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -10,9 +10,10 @@ // a variable. use arena::TypedArena; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::{self, HirIdMap}; use rustc::ty::{self, TyCtxt}; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; +use rustc_hir::HirIdMap; use std::fmt; use self::VarianceTerm::*; diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 69e05772906e0..a8003a588ba3a 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -1,6 +1,6 @@ -use rustc::hir; -use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; +use rustc_hir as hir; +use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_span::symbol::sym; use rustc_error_codes::*; diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index dec019711a012..c8b63ed5c8096 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -1,7 +1,7 @@ -use rustc::hir; use rustc::traits::auto_trait::{self, AutoTraitResult}; use rustc::ty::{self, Region, RegionVid, TypeFoldable}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; use std::fmt::Debug; diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 635713bdf1db4..525b1b2e6ecf7 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -1,9 +1,9 @@ -use rustc::hir; -use rustc::hir::def_id::LOCAL_CRATE; use rustc::infer::InferOk; use rustc::traits; use rustc::ty::subst::Subst; use rustc::ty::ToPredicate; +use rustc_hir as hir; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_span::DUMMY_SP; use super::*; diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 49baff065c873..2400dded66668 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -2,18 +2,18 @@ use std::iter::once; +use rustc::ty; +use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::def_id::DefId; +use rustc_hir::Mutability; +use rustc_metadata::creader::LoadedMacro; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::sym; use rustc_span::Span; use syntax::ast; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, Mutability}; -use rustc::ty; -use rustc_data_structures::fx::FxHashSet; -use rustc_metadata::creader::LoadedMacro; - use crate::clean::{self, GetDefId, ToSource, TypeKind}; use crate::core::DocContext; use crate::doctree; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index fad2bab43b990..bb46a15258e0f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -9,9 +9,6 @@ mod simplify; pub mod types; pub mod utils; -use rustc::hir; -use rustc::hir::def::{CtorKind, DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::infer::region_constraints::{Constraint, RegionConstraintData}; use rustc::middle::lang_items; use rustc::middle::resolve_lifetime as rl; @@ -20,6 +17,9 @@ use rustc::ty::fold::TypeFolder; use rustc::ty::subst::InternalSubsts; use rustc::ty::{self, AdtKind, Lift, Ty, TyCtxt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{CtorKind, DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc_index::vec::{Idx, IndexVec}; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym}; @@ -1003,8 +1003,8 @@ impl<'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { impl Clean for hir::FunctionRetTy<'_> { fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy { match *self { - hir::Return(ref typ) => Return(typ.clean(cx)), - hir::DefaultReturn(..) => DefaultReturn, + Self::Return(ref typ) => Return(typ.clean(cx)), + Self::DefaultReturn(..) => DefaultReturn, } } } @@ -1313,7 +1313,7 @@ impl Clean for ty::AssocItem { impl Clean for hir::Ty<'_> { fn clean(&self, cx: &DocContext<'_>) -> Type { - use rustc::hir::*; + use rustc_hir::*; match self.kind { TyKind::Never => Never, @@ -1808,7 +1808,7 @@ impl Clean for doctree::Union<'_> { } } -impl Clean for ::rustc::hir::VariantData<'_> { +impl Clean for rustc_hir::VariantData<'_> { fn clean(&self, cx: &DocContext<'_>) -> VariantStruct { VariantStruct { struct_type: doctree::struct_type_from_def(self), diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 49c3837d4fb30..c7b12d38c430a 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -14,8 +14,8 @@ use std::collections::BTreeMap; use std::mem; -use rustc::hir::def_id::DefId; use rustc::ty; +use rustc_hir::def_id::DefId; use crate::clean; use crate::clean::GenericArgs as PP; diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 6bb1ef7d1261b..c8f1dff703fb4 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -8,13 +8,14 @@ use std::rc::Rc; use std::sync::Arc; use std::{slice, vec}; -use rustc::hir::def::Res; -use rustc::hir::def_id::{CrateNum, DefId}; -use rustc::hir::{self, Mutability}; use rustc::middle::lang_items; use rustc::middle::stability; use rustc::ty::layout::VariantIdx; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::Res; +use rustc_hir::def_id::{CrateNum, DefId}; +use rustc_hir::Mutability; use rustc_index::vec::IndexVec; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::DUMMY_SP; @@ -701,7 +702,7 @@ impl GenericBound { } pub fn is_sized_bound(&self, cx: &DocContext<'_>) -> bool { - use rustc::hir::TraitBoundModifier as TBM; + use rustc_hir::TraitBoundModifier as TBM; if let GenericBound::TraitBound(PolyTrait { ref trait_, .. }, TBM::None) = *self { if trait_.def_id() == cx.tcx.lang_items().sized_trait() { return true; diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index d17b3ce0b1bc2..874cb9b8a5c9e 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -9,13 +9,13 @@ use crate::clean::{ use crate::core::DocContext; use itertools::Itertools; -use rustc::hir; -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::interpret::{sign_extend, ConstValue, Scalar}; use rustc::ty::subst::{GenericArgKind, SubstsRef}; use rustc::ty::{self, DefIdTree, Ty}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_span; use rustc_span::symbol::{kw, sym, Symbol}; use std::mem; @@ -412,7 +412,7 @@ impl ToSource for rustc_span::Span { } pub fn name_from_pat(p: &hir::Pat) -> String { - use rustc::hir::*; + use rustc_hir::*; debug!("trying to get a name from pattern: {:?}", p); match p.kind { @@ -567,12 +567,12 @@ pub fn resolve_type(cx: &DocContext<'_>, path: Path, id: hir::HirId) -> Type { let is_generic = match path.res { Res::PrimTy(p) => match p { - hir::Str => return Primitive(PrimitiveType::Str), - hir::Bool => return Primitive(PrimitiveType::Bool), - hir::Char => return Primitive(PrimitiveType::Char), - hir::Int(int_ty) => return Primitive(int_ty.into()), - hir::Uint(uint_ty) => return Primitive(uint_ty.into()), - hir::Float(float_ty) => return Primitive(float_ty.into()), + hir::PrimTy::Str => return Primitive(PrimitiveType::Str), + hir::PrimTy::Bool => return Primitive(PrimitiveType::Bool), + hir::PrimTy::Char => return Primitive(PrimitiveType::Char), + hir::PrimTy::Int(int_ty) => return Primitive(int_ty.into()), + hir::PrimTy::Uint(uint_ty) => return Primitive(uint_ty.into()), + hir::PrimTy::Float(float_ty) => return Primitive(float_ty.into()), }, Res::SelfTy(..) if path.segments.len() == 1 => { return Generic(kw::SelfUpper.to_string()); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 988d35117ae02..50d62027c8c6d 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,6 +1,3 @@ -use rustc::hir::def::Namespace::TypeNS; -use rustc::hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE}; -use rustc::hir::HirId; use rustc::lint; use rustc::middle::cstore::CrateStore; use rustc::middle::privacy::AccessLevels; @@ -11,6 +8,9 @@ use rustc::ty::{Ty, TyCtxt}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_driver::abort_on_err; use rustc_feature::UnstableFeatures; +use rustc_hir::def::Namespace::TypeNS; +use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE}; +use rustc_hir::HirId; use rustc_interface::interface; use rustc_lint; use rustc_resolve as resolve; diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 81f2db91fd513..178ba69277233 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -7,8 +7,8 @@ use rustc_span::{self, Span}; use syntax::ast; use syntax::ast::Name; -use rustc::hir; -use rustc::hir::def_id::CrateNum; +use rustc_hir as hir; +use rustc_hir::def_id::CrateNum; pub struct Module<'hir> { pub name: Option, diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index f84fef2761eca..2580bbf982b04 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -9,9 +9,9 @@ use std::borrow::Cow; use std::cell::Cell; use std::fmt; -use rustc::hir; -use rustc::hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; use rustc_target::spec::abi::Abi; use crate::clean::{self, PrimitiveType}; diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index c315cefc1b88b..7958c5ca2b6e6 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -43,13 +43,14 @@ use std::str; use std::sync::Arc; use errors; -use rustc::hir::def_id::DefId; -use rustc::hir::{self, Mutability}; use rustc::middle::privacy::AccessLevels; use rustc::middle::stability; use rustc_data_structures::flock; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_feature::UnstableFeatures; +use rustc_hir as hir; +use rustc_hir::def_id::DefId; +use rustc_hir::Mutability; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::FileName; diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index 6de56ec5127ed..22507443b0842 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -1,8 +1,8 @@ use crate::clean::{self, AttributesExt, GetDefId}; use crate::fold::DocFolder; -use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::middle::privacy::AccessLevels; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc_span::source_map::FileName; use rustc_span::symbol::sym; use std::collections::BTreeMap; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index c8a32306194df..16917181471f5 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -27,6 +27,7 @@ extern crate rustc_driver; extern crate rustc_error_codes; extern crate rustc_expand; extern crate rustc_feature; +extern crate rustc_hir; extern crate rustc_index; extern crate rustc_interface; extern crate rustc_lexer; diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index a8bb40a06b989..8a3966c320b8e 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1,15 +1,15 @@ use errors::Applicability; -use rustc::hir; -use rustc::hir::def::{ - DefKind, - Namespace::{self, *}, - PerNS, Res, -}; -use rustc::hir::def_id::DefId; use rustc::lint; use rustc::ty; use rustc_expand::base::SyntaxExtensionKind; use rustc_feature::UnstableFeatures; +use rustc_hir as hir; +use rustc_hir::def::{ + DefKind, + Namespace::{self, *}, + PerNS, Res, +}; +use rustc_hir::def_id::DefId; use rustc_resolve::ParentScope; use rustc_span::symbol::Symbol; use rustc_span::DUMMY_SP; diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index d9360f24a787c..c00e231ef70a2 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -3,8 +3,8 @@ use crate::clean::*; use crate::core::DocContext; use crate::fold::DocFolder; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_span::symbol::sym; pub const COLLECT_TRAIT_IMPLS: Pass = Pass { diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 784d967017db0..aebed9171d0e4 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -1,9 +1,9 @@ //! Contains information about "passes", used to modify crate information during the documentation //! process. -use rustc::hir::def_id::{DefId, DefIdSet}; use rustc::lint; use rustc::middle::privacy::AccessLevels; +use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_span::{InnerSpan, Span, DUMMY_SP}; use std::mem; use std::ops::Range; diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index 5fd97d1685ac6..08a88c00cb0dd 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -1,4 +1,4 @@ -use rustc::hir::def_id::DefIdSet; +use rustc_hir::def_id::DefIdSet; use rustc_span::symbol::sym; use std::mem; diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index 167aa2ca7d230..f4ec9cc364904 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -1,4 +1,4 @@ -use rustc::hir::def_id::DefIdSet; +use rustc_hir::def_id::DefIdSet; use crate::clean; use crate::core::DocContext; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index d7285b9d0bb07..010c27bbbc184 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -1,9 +1,10 @@ -use rustc::hir; use rustc::hir::intravisit; +use rustc::hir::map::Map; use rustc::session::{self, config, DiagnosticOutput}; use rustc::util::common::ErrorReported; use rustc_data_structures::sync::Lrc; use rustc_feature::UnstableFeatures; +use rustc_hir as hir; use rustc_interface::interface; use rustc_span::edition::Edition; use rustc_span::source_map::SourceMap; @@ -135,7 +136,7 @@ pub fn run(options: Options) -> i32 { } // Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade. -fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions { +fn scrape_test_config(krate: &::rustc_hir::Crate) -> TestOptions { use syntax::print::pprust; let mut opts = @@ -856,7 +857,7 @@ impl Tester for Collector { struct HirCollector<'a, 'hir> { sess: &'a session::Session, collector: &'a mut Collector, - map: &'a hir::map::Map<'hir>, + map: &'a Map<'hir>, codes: ErrorCodes, } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 707d9a999e529..d7bf8d157d21a 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -1,12 +1,13 @@ //! The Rust AST Visitor. Extracts useful information and massages it into a form //! usable for `clean`. -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::{self, Node}; use rustc::middle::privacy::AccessLevel; use rustc::ty::TyCtxt; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; +use rustc_hir::Node; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::Spanned; use rustc_span::symbol::sym; diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index d157a0ca03fd0..12ffd6cac81dc 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -1,8 +1,8 @@ -use rustc::hir::def::{DefKind, Res}; -use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc::middle::privacy::{AccessLevel, AccessLevels}; use rustc::ty::{TyCtxt, Visibility}; use rustc_data_structures::fx::FxHashSet; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX}; use rustc_span::symbol::sym; use crate::clean::{AttributesExt, NestedAttributesExt}; diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 84b8c7c6e43c7..84bcd220ae766 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -4,6 +4,7 @@ extern crate rustc; extern crate rustc_codegen_utils; #[macro_use] extern crate rustc_data_structures; +extern crate rustc_hir; extern crate rustc_target; extern crate rustc_driver; extern crate rustc_span; @@ -65,7 +66,7 @@ impl CodegenBackend for TheBackend { _metadata: EncodedMetadata, _need_metadata_module: bool, ) -> Box { - use rustc::hir::def_id::LOCAL_CRATE; + use rustc_hir::def_id::LOCAL_CRATE; Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol) } diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index 6163f270fe313..ee14d71573041 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -4,10 +4,13 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_hir; extern crate rustc_span; extern crate syntax; -use rustc::hir::{self, intravisit, Node}; +use rustc::hir::intravisit; +use rustc_hir as hir; +use rustc_hir::Node; use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; use rustc_driver::plugin::Registry; use rustc_span::source_map; diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index 47751f4711f4d..4ccbe8a3c0eb0 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -5,10 +5,10 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_hir; extern crate rustc_span; extern crate syntax; -use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass}; use rustc_driver::plugin::Registry; use rustc_span::symbol::Symbol; @@ -25,7 +25,7 @@ macro_rules! fake_lint_pass { } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) { $( if !attr::contains_name(&krate.attrs, $attr) { cx.span_lint(CRATE_NOT_OKAY, krate.span, diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index 4821c9b02fe19..360bffaa46f2b 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -6,10 +6,10 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_hir; extern crate rustc_span; extern crate syntax; -use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LintArray}; use rustc_driver::plugin::Registry; use rustc_span::symbol::Symbol; @@ -24,7 +24,7 @@ declare_lint! { declare_lint_pass!(Pass => [CRATE_NOT_OKAY]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + fn check_crate(&mut self, cx: &LateContext, krate: &rustc_hir::Crate) { if !attr::contains_name(&krate.attrs, Symbol::intern("crate_okay")) { cx.span_lint(CRATE_NOT_OKAY, krate.span, "crate is not marked with #![crate_okay]"); diff --git a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs index 839c65a610755..786c699947e47 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs @@ -7,8 +7,8 @@ #[macro_use] extern crate rustc; #[macro_use] extern crate rustc_session; extern crate rustc_driver; +extern crate rustc_hir; -use rustc::hir; use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LintArray, LintId}; use rustc_driver::plugin::Registry; @@ -19,7 +19,7 @@ declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { + fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) { match &*it.ident.as_str() { "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),