mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-14 16:03:17 +00:00
Merge #10598
10598: minor: Remove obsolete test module r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
c2e36291f3
@ -38,9 +38,6 @@ use crate::{
|
|||||||
proc_macro::ProcMacroExpander,
|
proc_macro::ProcMacroExpander,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test_db;
|
|
||||||
|
|
||||||
/// Input to the analyzer is a set of files, where each file is identified by
|
/// 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
|
/// `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
|
/// Rust are macros: each macro can be thought of as producing a "temporary
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
//! Database used for testing `hir_expand`.
|
|
||||||
|
|
||||||
use std::{
|
|
||||||
fmt, panic,
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use base_db::{salsa, AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate};
|
|
||||||
use rustc_hash::FxHashSet;
|
|
||||||
|
|
||||||
#[salsa::database(
|
|
||||||
base_db::SourceDatabaseExtStorage,
|
|
||||||
base_db::SourceDatabaseStorage,
|
|
||||||
crate::db::AstDatabaseStorage
|
|
||||||
)]
|
|
||||||
#[derive(Default)]
|
|
||||||
pub(crate) struct TestDB {
|
|
||||||
storage: salsa::Storage<TestDB>,
|
|
||||||
events: Mutex<Option<Vec<salsa::Event>>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Debug for TestDB {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
f.debug_struct("TestDB").finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl salsa::Database for TestDB {
|
|
||||||
fn salsa_event(&self, event: salsa::Event) {
|
|
||||||
let mut events = self.events.lock().unwrap();
|
|
||||||
if let Some(events) = &mut *events {
|
|
||||||
events.push(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl panic::RefUnwindSafe for TestDB {}
|
|
||||||
|
|
||||||
impl FileLoader for TestDB {
|
|
||||||
fn file_text(&self, file_id: FileId) -> Arc<String> {
|
|
||||||
FileLoaderDelegate(self).file_text(file_id)
|
|
||||||
}
|
|
||||||
fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> {
|
|
||||||
FileLoaderDelegate(self).resolve_path(path)
|
|
||||||
}
|
|
||||||
fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
|
|
||||||
FileLoaderDelegate(self).relevant_crates(file_id)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user