diff --git a/crates/ra_hir/src/debug.rs b/crates/ra_hir/src/debug.rs index c3f890ed4a1..4f3e922c3c5 100644 --- a/crates/ra_hir/src/debug.rs +++ b/crates/ra_hir/src/debug.rs @@ -36,12 +36,6 @@ pub fn debug(self, db: &impl HirDebugDatabase) -> impl fmt::Debug + '_ { } } -// impl HirFileId { -// pub fn debug(self, db: &impl HirDebugDatabase) -> impl fmt::Debug + '_ { -// debug_fn(move |fmt| db.debug_hir_file_id(self, fmt)) -// } -// } - pub trait HirDebugHelper: HirDatabase { fn crate_name(&self, _krate: CrateId) -> Option { None diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 5762b9e52f6..0f2d233bb1b 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -59,12 +59,13 @@ fn from(it: $sv) -> $e { #[cfg(test)] mod marks; -use hir_expand::{ast_id_map::FileAstId, AstId}; +use hir_expand::{ + ast_id_map::{AstIdMap, FileAstId}, + AstId, +}; use crate::{ids::MacroFileKind, name::AsName, resolve::Resolver}; -use hir_expand::ast_id_map::AstIdMap; - pub use crate::{ adt::VariantDef, either::Either, diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 749227465f5..6b35386730c 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -14,19 +14,6 @@ use crate::{ast_id_map::FileAstId, db::AstDatabase}; -macro_rules! impl_intern_key { - ($name:ident) => { - impl salsa::InternKey for $name { - fn from_intern_id(v: salsa::InternId) -> Self { - $name(v) - } - fn as_intern_id(&self) -> salsa::InternId { - self.0 - } - } - }; -} - /// Input to the analyzer is a set of files, where each file is identified by /// `FileId` and contains source code. However, another source of source code in /// Rust are macros: each macro can be thought of as producing a "temporary @@ -101,7 +88,14 @@ pub enum MacroFileKind { /// `println!("Hello, {}", world)`. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct MacroCallId(salsa::InternId); -impl_intern_key!(MacroCallId); +impl salsa::InternKey for MacroCallId { + fn from_intern_id(v: salsa::InternId) -> Self { + MacroCallId(v) + } + fn as_intern_id(&self) -> salsa::InternId { + self.0 + } +} #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct MacroDefId { diff --git a/crates/ra_ide_api/Cargo.toml b/crates/ra_ide_api/Cargo.toml index f66f0a6bade..bf6ef12f3ff 100644 --- a/crates/ra_ide_api/Cargo.toml +++ b/crates/ra_ide_api/Cargo.toml @@ -27,10 +27,13 @@ ra_db = { path = "../ra_db" } ra_cfg = { path = "../ra_cfg" } ra_fmt = { path = "../ra_fmt" } ra_prof = { path = "../ra_prof" } -hir = { path = "../ra_hir", package = "ra_hir" } test_utils = { path = "../test_utils" } ra_assists = { path = "../ra_assists" } +# ra_ide_api should depend only on the top-level `hir` package. if you need +# something from some `hir_xxx` subpackage, reexport the API via `hir`. +hir = { path = "../ra_hir", package = "ra_hir" } + [dev-dependencies] insta = "0.12.0"