This commit is contained in:
Aleksey Kladov 2019-10-29 16:19:08 +03:00
parent 99b6ecfab0
commit bca708ba4c
4 changed files with 16 additions and 24 deletions

View File

@ -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<String> {
None

View File

@ -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,

View File

@ -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 {

View File

@ -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"