]> git.lizzy.rs Git - rust.git/commitdiff
Remove last traces of nameres from hir
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 3 Nov 2019 20:49:44 +0000 (23:49 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 3 Nov 2019 20:49:44 +0000 (23:49 +0300)
crates/ra_hir/src/code_model.rs
crates/ra_hir/src/db.rs
crates/ra_hir/src/lib.rs
crates/ra_hir/src/nameres.rs [deleted file]
crates/ra_hir/src/resolve.rs
crates/ra_hir/src/ty/infer/expr.rs
crates/ra_hir/src/ty/lower.rs
crates/ra_hir_def/src/nameres.rs

index f03b59217fe0e0c8c306b75d5548c4c61296b91d..181c5d47afebd559a1c83dc071702331887fc3f9 100644 (file)
         TypeAliasId,
     },
     impl_block::ImplBlock,
-    nameres::{ImportId, Namespace},
     resolve::{Resolver, Scope, TypeNs},
     traits::TraitData,
     ty::{InferenceResult, TraitRef},
-    Either, HasSource, Name, ScopeDef, Ty,
+    Either, HasSource, Name, ScopeDef, Ty, {ImportId, Namespace},
 };
 
 /// hir::Crate describes a single crate. It's the main interface with which
index f45804c7ce902b35bbf58607ce4469bb7d7ed7a7..eb66325f7f12624f32ba8650306386125424b0f4 100644 (file)
     ids,
     impl_block::{ImplBlock, ImplSourceMap, ModuleImplBlocks},
     lang_item::{LangItemTarget, LangItems},
-    nameres::Namespace,
     traits::TraitData,
     ty::{
         method_resolution::CrateImplBlocks, traits::Impl, CallableDef, FnSig, GenericPredicate,
         InferenceResult, Substs, Ty, TypableDef, TypeCtor,
     },
     type_alias::TypeAliasData,
-    Const, ConstData, Crate, DefWithBody, ExprScopes, FnData, Function, Module, Static,
+    Const, ConstData, Crate, DefWithBody, ExprScopes, FnData, Function, Module, Namespace, Static,
     StructField, Trait, TypeAlias,
 };
 
index 52bad22284b96963b6051de3050e5583b3ff1589..3ba99d92d70313671925d31696b150e9bd90dd7d 100644 (file)
@@ -34,7 +34,6 @@ fn from(it: $sv) -> $e {
 pub mod source_binder;
 
 mod ids;
-mod nameres;
 mod adt;
 mod traits;
 mod type_alias;
@@ -73,7 +72,6 @@ fn from(it: $sv) -> $e {
     generics::{GenericDef, GenericParam, GenericParams, HasGenericParams},
     ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile},
     impl_block::ImplBlock,
-    nameres::{ImportId, Namespace, PerNs},
     resolve::ScopeDef,
     source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer},
     ty::{
@@ -83,6 +81,10 @@ fn from(it: $sv) -> $e {
 
 pub use hir_def::{
     builtin_type::BuiltinType,
+    nameres::{
+        per_ns::{Namespace, PerNs},
+        raw::ImportId,
+    },
     path::{Path, PathKind},
     type_ref::Mutability,
 };
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
deleted file mode 100644 (file)
index 875addc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//! This module implements import-resolution/macro expansion algorithm.
-//!
-//! The result of this module is `CrateDefMap`: a data structure which contains:
-//!
-//!   * a tree of modules for the crate
-//!   * for each module, a set of items visible in the module (directly declared
-//!     or imported)
-//!
-//! Note that `CrateDefMap` contains fully macro expanded code.
-//!
-//! Computing `CrateDefMap` can be partitioned into several logically
-//! independent "phases". The phases are mutually recursive though, there's no
-//! strict ordering.
-//!
-//! ## Collecting RawItems
-//!
-//!  This happens in the `raw` module, which parses a single source file into a
-//!  set of top-level items. Nested imports are desugared to flat imports in
-//!  this phase. Macro calls are represented as a triple of (Path, Option<Name>,
-//!  TokenTree).
-//!
-//! ## Collecting Modules
-//!
-//! This happens in the `collector` module. In this phase, we recursively walk
-//! tree of modules, collect raw items from submodules, populate module scopes
-//! with defined items (so, we assign item ids in this phase) and record the set
-//! of unresolved imports and macros.
-//!
-//! While we walk tree of modules, we also record macro_rules definitions and
-//! expand calls to macro_rules defined macros.
-//!
-//! ## Resolving Imports
-//!
-//! We maintain a list of currently unresolved imports. On every iteration, we
-//! try to resolve some imports from this list. If the import is resolved, we
-//! record it, by adding an item to current module scope and, if necessary, by
-//! recursively populating glob imports.
-//!
-//! ## Resolving Macros
-//!
-//! macro_rules from the same crate use a global mutable namespace. We expand
-//! them immediately, when we collect modules.
-//!
-//! Macros from other crates (including proc-macros) can be used with
-//! `foo::bar!` syntax. We handle them similarly to imports. There's a list of
-//! unexpanded macros. On every iteration, we try to resolve each macro call
-//! path and, upon success, we run macro expansion and "collect module" phase
-//! on the result
-
-pub use hir_def::nameres::{
-    per_ns::{Namespace, PerNs},
-    raw::ImportId,
-};
index 3e3f8c252e2e57ed1fe66937d25ddc0445d3de6f..b932b0c8cdbca0000a12172da3c3cb978fe9995c 100644 (file)
@@ -19,8 +19,8 @@
     },
     generics::GenericParams,
     impl_block::ImplBlock,
-    nameres::PerNs,
-    Adt, Const, Enum, EnumVariant, Function, MacroDef, ModuleDef, Static, Struct, Trait, TypeAlias,
+    Adt, Const, Enum, EnumVariant, Function, MacroDef, ModuleDef, PerNs, Static, Struct, Trait,
+    TypeAlias,
 };
 
 #[derive(Debug, Clone, Default)]
index fed52df39cef186978fb4edc18786e8620f150e0..a09ef5c5d3afc09247f635dfdd577872eb9ec1ae 100644 (file)
     db::HirDatabase,
     expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
     generics::{GenericParams, HasGenericParams},
-    nameres::Namespace,
     ty::{
         autoderef, method_resolution, op, primitive, CallableDef, InferTy, Mutability, Obligation,
         ProjectionPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk,
     },
-    Adt, Name,
+    Adt, Name, Namespace,
 };
 
 impl<'a, D: HirDatabase> InferenceContext<'a, D> {
index 8e28343071a29ae2e60a275d7bf030b45705c3de..e29ab8492a5eed2a5bc107d34f76072661196229 100644 (file)
     db::HirDatabase,
     generics::HasGenericParams,
     generics::{GenericDef, WherePredicate},
-    nameres::Namespace,
     resolve::{Resolver, TypeNs},
     ty::{
         primitive::{FloatTy, IntTy},
         Adt,
     },
     util::make_mut_slice,
-    Const, Enum, EnumVariant, Function, ModuleDef, Path, Static, Struct, StructField, Trait,
-    TypeAlias, Union,
+    Const, Enum, EnumVariant, Function, ModuleDef, Namespace, Path, Static, Struct, StructField,
+    Trait, TypeAlias, Union,
 };
 
 impl Ty {
index b5c682219349a6a16a7ccd3165f50adb6eb1460b..fbd4248e6a7495123b69bc8c79614882a5828be6 100644 (file)
@@ -1,4 +1,51 @@
-//! FIXME: write short doc here
+//! This module implements import-resolution/macro expansion algorithm.
+//!
+//! The result of this module is `CrateDefMap`: a data structure which contains:
+//!
+//!   * a tree of modules for the crate
+//!   * for each module, a set of items visible in the module (directly declared
+//!     or imported)
+//!
+//! Note that `CrateDefMap` contains fully macro expanded code.
+//!
+//! Computing `CrateDefMap` can be partitioned into several logically
+//! independent "phases". The phases are mutually recursive though, there's no
+//! strict ordering.
+//!
+//! ## Collecting RawItems
+//!
+//!  This happens in the `raw` module, which parses a single source file into a
+//!  set of top-level items. Nested imports are desugared to flat imports in
+//!  this phase. Macro calls are represented as a triple of (Path, Option<Name>,
+//!  TokenTree).
+//!
+//! ## Collecting Modules
+//!
+//! This happens in the `collector` module. In this phase, we recursively walk
+//! tree of modules, collect raw items from submodules, populate module scopes
+//! with defined items (so, we assign item ids in this phase) and record the set
+//! of unresolved imports and macros.
+//!
+//! While we walk tree of modules, we also record macro_rules definitions and
+//! expand calls to macro_rules defined macros.
+//!
+//! ## Resolving Imports
+//!
+//! We maintain a list of currently unresolved imports. On every iteration, we
+//! try to resolve some imports from this list. If the import is resolved, we
+//! record it, by adding an item to current module scope and, if necessary, by
+//! recursively populating glob imports.
+//!
+//! ## Resolving Macros
+//!
+//! macro_rules from the same crate use a global mutable namespace. We expand
+//! them immediately, when we collect modules.
+//!
+//! Macros from other crates (including proc-macros) can be used with
+//! `foo::bar!` syntax. We handle them similarly to imports. There's a list of
+//! unexpanded macros. On every iteration, we try to resolve each macro call
+//! path and, upon success, we run macro expansion and "collect module" phase
+//! on the result
 
 // FIXME: review privacy of submodules
 pub mod raw;