aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/Cargo.toml11
-rw-r--r--crates/ra_hir_ty/src/test_db.rs12
2 files changed, 12 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index 199afff49..429242870 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/ra_hir_ty/Cargo.toml
@@ -9,18 +9,17 @@ doctest = false
9 9
10[dependencies] 10[dependencies]
11arrayvec = "0.5.1" 11arrayvec = "0.5.1"
12ena = "0.13"
12log = "0.4.5" 13log = "0.4.5"
13rustc-hash = "1.0" 14rustc-hash = "1.0"
14parking_lot = "0.10.0"
15ena = "0.13"
16 15
17ra_syntax = { path = "../ra_syntax" } 16hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
17hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
18ra_arena = { path = "../ra_arena" } 18ra_arena = { path = "../ra_arena" }
19ra_db = { path = "../ra_db" } 19ra_db = { path = "../ra_db" }
20hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
21hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
22test_utils = { path = "../test_utils" }
23ra_prof = { path = "../ra_prof" } 20ra_prof = { path = "../ra_prof" }
21ra_syntax = { path = "../ra_syntax" }
22test_utils = { path = "../test_utils" }
24 23
25# https://github.com/rust-lang/chalk/pull/294 24# https://github.com/rust-lang/chalk/pull/294
26chalk-solve = { git = "https://github.com/jackh726/chalk.git", rev = "095cd38a4f16337913bba487f2055b9ca0179f30" } 25chalk-solve = { git = "https://github.com/jackh726/chalk.git", rev = "095cd38a4f16337913bba487f2055b9ca0179f30" }
diff --git a/crates/ra_hir_ty/src/test_db.rs b/crates/ra_hir_ty/src/test_db.rs
index 0e51f4130..874357008 100644
--- a/crates/ra_hir_ty/src/test_db.rs
+++ b/crates/ra_hir_ty/src/test_db.rs
@@ -1,10 +1,12 @@
1//! Database used for testing `hir`. 1//! Database used for testing `hir`.
2 2
3use std::{panic, sync::Arc}; 3use std::{
4 panic,
5 sync::{Arc, Mutex},
6};
4 7
5use hir_def::{db::DefDatabase, AssocItemId, ModuleDefId, ModuleId}; 8use hir_def::{db::DefDatabase, AssocItemId, ModuleDefId, ModuleId};
6use hir_expand::diagnostics::DiagnosticSink; 9use hir_expand::diagnostics::DiagnosticSink;
7use parking_lot::Mutex;
8use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath, SourceDatabase}; 10use ra_db::{salsa, CrateId, FileId, FileLoader, FileLoaderDelegate, RelativePath, SourceDatabase};
9 11
10use crate::{db::HirDatabase, expr::ExprValidator}; 12use crate::{db::HirDatabase, expr::ExprValidator};
@@ -33,7 +35,7 @@ impl salsa::Database for TestDB {
33 } 35 }
34 36
35 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) { 37 fn salsa_event(&self, event: impl Fn() -> salsa::Event<TestDB>) {
36 let mut events = self.events.lock(); 38 let mut events = self.events.lock().unwrap();
37 if let Some(events) = &mut *events { 39 if let Some(events) = &mut *events {
38 events.push(event()); 40 events.push(event());
39 } 41 }
@@ -122,9 +124,9 @@ impl TestDB {
122 124
123impl TestDB { 125impl TestDB {
124 pub fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<TestDB>> { 126 pub fn log(&self, f: impl FnOnce()) -> Vec<salsa::Event<TestDB>> {
125 *self.events.lock() = Some(Vec::new()); 127 *self.events.lock().unwrap() = Some(Vec::new());
126 f(); 128 f();
127 self.events.lock().take().unwrap() 129 self.events.lock().unwrap().take().unwrap()
128 } 130 }
129 131
130 pub fn log_executed(&self, f: impl FnOnce()) -> Vec<String> { 132 pub fn log_executed(&self, f: impl FnOnce()) -> Vec<String> {