mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
fix tests
This commit is contained in:
parent
882a86240f
commit
832bae8e28
2 changed files with 9 additions and 2 deletions
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
SourceFileItems, SourceItemId,
|
SourceFileItems, SourceItemId,
|
||||||
query_definitions,
|
query_definitions,
|
||||||
FnScopes,
|
FnScopes,
|
||||||
macros::{MacroCallLoc, MacroCallId, MacroInput, MacroDef, MacroExpansion},
|
macros::{MacroCallLoc, MacroCallId, MacroExpansion},
|
||||||
module::{ModuleId, ModuleTree, ModuleSource,
|
module::{ModuleId, ModuleTree, ModuleSource,
|
||||||
nameres::{ItemMap, InputModuleItems}},
|
nameres::{ItemMap, InputModuleItems}},
|
||||||
ty::{InferenceResult, Ty},
|
ty::{InferenceResult, Ty},
|
||||||
|
|
|
@ -6,7 +6,7 @@ use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, Sou
|
||||||
use relative_path::RelativePathBuf;
|
use relative_path::RelativePathBuf;
|
||||||
use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
|
use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
|
||||||
|
|
||||||
use crate::{db, DefId, DefLoc};
|
use crate::{db, DefId, DefLoc, MacroCallId, MacroCallLoc};
|
||||||
|
|
||||||
pub const WORKSPACE: SourceRootId = SourceRootId(0);
|
pub const WORKSPACE: SourceRootId = SourceRootId(0);
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ impl MockDatabase {
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct IdMaps {
|
struct IdMaps {
|
||||||
defs: LocationIntener<DefLoc, DefId>,
|
defs: LocationIntener<DefLoc, DefId>,
|
||||||
|
macros: LocationIntener<MacroCallLoc, MacroCallId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl salsa::Database for MockDatabase {
|
impl salsa::Database for MockDatabase {
|
||||||
|
@ -144,6 +145,11 @@ impl AsRef<LocationIntener<DefLoc, DefId>> for MockDatabase {
|
||||||
&self.id_maps.defs
|
&self.id_maps.defs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl AsRef<LocationIntener<MacroCallLoc, MacroCallId>> for MockDatabase {
|
||||||
|
fn as_ref(&self) -> &LocationIntener<MacroCallLoc, MacroCallId> {
|
||||||
|
&self.id_maps.macros
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MockDatabase {
|
impl MockDatabase {
|
||||||
pub(crate) fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<MockDatabase>> {
|
pub(crate) fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<MockDatabase>> {
|
||||||
|
@ -183,6 +189,7 @@ salsa::database_storage! {
|
||||||
fn file_lines() for ra_db::FileLinesQuery;
|
fn file_lines() for ra_db::FileLinesQuery;
|
||||||
}
|
}
|
||||||
impl db::HirDatabase {
|
impl db::HirDatabase {
|
||||||
|
fn expand_macro_invocation() for db::ExpandMacroCallQuery;
|
||||||
fn module_tree() for db::ModuleTreeQuery;
|
fn module_tree() for db::ModuleTreeQuery;
|
||||||
fn fn_scopes() for db::FnScopesQuery;
|
fn fn_scopes() for db::FnScopesQuery;
|
||||||
fn file_items() for db::SourceFileItemsQuery;
|
fn file_items() for db::SourceFileItemsQuery;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue