{rustc::hir::map -> rustc_hir}::definitions

This commit is contained in:
Mazdak Farrokhzad 2020-03-21 04:39:48 +01:00
parent bb8785ea00
commit 14f89ded2c
13 changed files with 23 additions and 18 deletions

View File

@ -3726,6 +3726,7 @@ name = "rustc_hir"
version = "0.0.0"
dependencies = [
"lazy_static 1.4.0",
"log",
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",

View File

@ -122,7 +122,7 @@ macro_rules! arena_types {
// HIR query types
[few] indexed_hir: rustc::hir::map::IndexedHir<$tcx>,
[few] hir_definitions: rustc::hir::map::definitions::Definitions,
[few] hir_definitions: rustc_hir::definitions::Definitions,
[] hir_owner: rustc::hir::Owner<$tcx>,
[] hir_owner_nodes: rustc::hir::OwnerNodes<$tcx>,
], $tcx);

View File

@ -1,7 +1,4 @@
use self::collector::NodeCollector;
pub use self::definitions::{
DefKey, DefPath, DefPathData, DefPathHash, Definitions, DisambiguatedDefPathData,
};
use crate::hir::{Owner, OwnerNodes};
use crate::ty::query::Providers;
@ -10,6 +7,9 @@ use rustc_ast::ast::{self, Name, NodeId};
use rustc_data_structures::svh::Svh;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
pub use rustc_hir::definitions;
pub use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash};
pub use rustc_hir::definitions::{Definitions, DisambiguatedDefPathData};
use rustc_hir::intravisit;
use rustc_hir::itemlikevisit::ItemLikeVisitor;
use rustc_hir::print::Nested;
@ -23,7 +23,6 @@ use rustc_target::spec::abi::Abi;
pub mod blocks;
mod collector;
pub mod definitions;
mod hir_id_validator;
pub use hir_id_validator::check_crate;

View File

@ -36,7 +36,6 @@
#![feature(specialization)]
#![recursion_limit = "256"]
use rustc::hir::map::definitions::{DefKey, DefPathData, Definitions};
use rustc_ast::ast;
use rustc_ast::ast::*;
use rustc_ast::attr;
@ -53,6 +52,7 @@ use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX};
use rustc_hir::definitions::{DefKey, DefPathData, Definitions};
use rustc_hir::intravisit;
use rustc_hir::{ConstArg, GenericArg, ParamName};
use rustc_index::vec::IndexVec;

View File

@ -20,4 +20,5 @@ rustc_errors = { path = "../librustc_errors" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
rustc_ast = { path = "../librustc_ast" }
lazy_static = "1"
log = { version = "0.4", features = ["release_max_level_info", "std"] }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }

View File

@ -4,18 +4,21 @@
//! There are also some rather random cases (like const initializer
//! expressions) that are mostly just leftovers.
pub use crate::def_id::DefPathHash;
use crate::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::hir;
use crate::hir_id::DUMMY_HIR_ID;
use rustc_ast::ast;
use rustc_ast::crate_disambiguator::CrateDisambiguator;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::StableHasher;
use rustc_hir as hir;
pub use rustc_hir::def_id::DefPathHash;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_index::vec::IndexVec;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use log::debug;
use std::fmt::Write;
use std::hash::Hash;
@ -344,7 +347,7 @@ impl Definitions {
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<hir::HirId> {
if let Some(def_id) = def_id.as_local() {
let hir_id = self.local_def_id_to_hir_id(def_id);
if hir_id != hir::DUMMY_HIR_ID { Some(hir_id) } else { None }
if hir_id != DUMMY_HIR_ID { Some(hir_id) } else { None }
} else {
None
}

View File

@ -15,6 +15,7 @@ extern crate rustc_data_structures;
mod arena;
pub mod def;
pub mod definitions;
pub use rustc_span::def_id;
mod hir;
pub mod hir_id;

View File

@ -18,7 +18,6 @@ use self::TargetLint::*;
use crate::levels::LintLevelsBuilder;
use crate::passes::{EarlyLintPassObject, LateLintPassObject};
use rustc::hir::map::definitions::{DefPathData, DisambiguatedDefPathData};
use rustc::lint::LintDiagnosticBuilder;
use rustc::middle::privacy::AccessLevels;
use rustc::middle::stability;
@ -31,6 +30,7 @@ use rustc_data_structures::sync;
use rustc_errors::{struct_span_err, Applicability};
use rustc_hir as hir;
use rustc_hir::def_id::{CrateNum, DefId};
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
use rustc_session::lint::{add_elided_lifetime_in_path_suggestion, BuiltinLintDiagnostics};
use rustc_session::lint::{FutureIncompatibleInfo, Level, Lint, LintBuffer, LintId};
use rustc_session::Session;

View File

@ -6,8 +6,6 @@ use crate::rmeta::*;
use rustc::dep_graph::{self, DepNode, DepNodeIndex};
use rustc::hir::exports::Export;
use rustc::hir::map::definitions::DefPathTable;
use rustc::hir::map::{DefKey, DefPath, DefPathData, DefPathHash};
use rustc::middle::cstore::{CrateSource, ExternCrate};
use rustc::middle::cstore::{ForeignModule, LinkagePreference, NativeLibrary};
use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
@ -29,6 +27,8 @@ use rustc_expand::proc_macro::{AttrProcMacro, BangProcMacro, ProcMacroDerive};
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_hir::definitions::DefPathTable;
use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash};
use rustc_index::vec::{Idx, IndexVec};
use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder};
use rustc_session::Session;

View File

@ -5,8 +5,6 @@ use crate::native_libs;
use crate::rmeta::{self, encoder};
use rustc::hir::exports::Export;
use rustc::hir::map::definitions::DefPathTable;
use rustc::hir::map::{DefKey, DefPath, DefPathHash};
use rustc::middle::cstore::{CrateSource, CrateStore, EncodedMetadata, NativeLibraryKind};
use rustc::middle::exported_symbols::ExportedSymbol;
use rustc::middle::stability::DeprecationEntry;
@ -19,6 +17,8 @@ use rustc_ast::expand::allocator::AllocatorKind;
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_hir::definitions::DefPathTable;
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
use rustc_session::{CrateDisambiguator, Session};
use rustc_span::source_map::{self, Span, Spanned};
use rustc_span::symbol::Symbol;

View File

@ -2,7 +2,6 @@ use crate::rmeta::table::FixedSizeEncoding;
use crate::rmeta::*;
use log::{debug, trace};
use rustc::hir::map::definitions::DefPathTable;
use rustc::hir::map::Map;
use rustc::middle::cstore::{EncodedMetadata, ForeignModule, LinkagePreference, NativeLibrary};
use rustc::middle::dependency_format::Linkage;
@ -23,6 +22,7 @@ use rustc_hir as hir;
use rustc_hir::def::CtorKind;
use rustc_hir::def_id::DefIdSet;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::DefPathTable;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor};
use rustc_hir::{AnonConst, GenericParamKind};

View File

@ -1,10 +1,10 @@
use log::debug;
use rustc::hir::map::definitions::*;
use rustc_ast::ast::*;
use rustc_ast::token::{self, Token};
use rustc_ast::visit::{self, FnKind};
use rustc_expand::expand::AstFragment;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::definitions::*;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{kw, sym};
use rustc_span::Span;

View File

@ -1,6 +1,5 @@
mod environment;
use rustc::hir::map::definitions::DefPathData;
use rustc::hir::map::Map;
use rustc::traits::{
Clause, Clauses, DomainGoal, FromEnv, GoalKind, PolyDomainGoal, ProgramClause,
@ -13,6 +12,7 @@ use rustc_ast::ast;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::definitions::DefPathData;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_span::symbol::sym;