aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-31 13:42:32 +0100
committerGitHub <[email protected]>2021-05-31 13:42:32 +0100
commite9a797748daa7e25cde66927b8907b2d976201a5 (patch)
tree438bb6e1a2c5e422ee18994d2e045480b429d549 /crates/ide_db
parentb8d269990c57634e77f4702afc91041bacb4816a (diff)
parentacb5c227ed2d2d52d67ab56a61e6944cd4d5de88 (diff)
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/lib.rs20
-rw-r--r--crates/ide_db/src/symbol_index.rs2
2 files changed, 4 insertions, 18 deletions
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs
index 88ee4a87d..1f900aef4 100644
--- a/crates/ide_db/src/lib.rs
+++ b/crates/ide_db/src/lib.rs
@@ -19,8 +19,7 @@ use std::{fmt, sync::Arc};
19 19
20use base_db::{ 20use base_db::{
21 salsa::{self, Durability}, 21 salsa::{self, Durability},
22 AnchoredPath, Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, 22 AnchoredPath, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, Upcast,
23 SourceDatabase, Upcast,
24}; 23};
25use hir::db::{AstDatabase, DefDatabase, HirDatabase}; 24use hir::db::{AstDatabase, DefDatabase, HirDatabase};
26use rustc_hash::FxHashSet; 25use rustc_hash::FxHashSet;
@@ -80,20 +79,7 @@ impl FileLoader for RootDatabase {
80 } 79 }
81} 80}
82 81
83impl salsa::Database for RootDatabase { 82impl salsa::Database for RootDatabase {}
84 fn on_propagated_panic(&self) -> ! {
85 Canceled::throw()
86 }
87 fn salsa_event(&self, event: salsa::Event) {
88 match event.kind {
89 salsa::EventKind::DidValidateMemoizedValue { .. }
90 | salsa::EventKind::WillExecute { .. } => {
91 self.check_canceled();
92 }
93 _ => (),
94 }
95 }
96}
97 83
98impl Default for RootDatabase { 84impl Default for RootDatabase {
99 fn default() -> RootDatabase { 85 fn default() -> RootDatabase {
@@ -126,7 +112,7 @@ impl salsa::ParallelDatabase for RootDatabase {
126} 112}
127 113
128#[salsa::query_group(LineIndexDatabaseStorage)] 114#[salsa::query_group(LineIndexDatabaseStorage)]
129pub trait LineIndexDatabase: base_db::SourceDatabase + CheckCanceled { 115pub trait LineIndexDatabase: base_db::SourceDatabase {
130 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>; 116 fn line_index(&self, file_id: FileId) -> Arc<LineIndex>;
131} 117}
132 118
diff --git a/crates/ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs
index 0f5c4abc4..5c372a7e5 100644
--- a/crates/ide_db/src/symbol_index.rs
+++ b/crates/ide_db/src/symbol_index.rs
@@ -127,7 +127,7 @@ fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, Symb
127} 127}
128 128
129fn file_symbols(db: &dyn SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { 129fn file_symbols(db: &dyn SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> {
130 db.check_canceled(); 130 db.unwind_if_cancelled();
131 let parse = db.parse(file_id); 131 let parse = db.parse(file_id);
132 132
133 let symbols = source_file_to_file_symbols(&parse.tree(), file_id); 133 let symbols = source_file_to_file_symbols(&parse.tree(), file_id);