Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/base-db/src/lib.rs')
-rw-r--r--crates/base-db/src/lib.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/crates/base-db/src/lib.rs b/crates/base-db/src/lib.rs
index b65cf7341f..7593135c5c 100644
--- a/crates/base-db/src/lib.rs
+++ b/crates/base-db/src/lib.rs
@@ -6,9 +6,10 @@ mod input;
mod change;
pub mod fixture;
-use std::{panic, sync::Arc};
+use std::{hash::BuildHasherDefault, panic, sync::Arc};
-use rustc_hash::FxHashSet;
+use indexmap::IndexSet;
+use rustc_hash::FxHasher;
use syntax::{ast, Parse, SourceFile, TextRange, TextSize};
pub use crate::{
@@ -59,7 +60,10 @@ pub trait FileLoader {
/// Text of the file.
fn file_text(&self, file_id: FileId) -> Arc<str>;
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId>;
- fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>>;
+ fn relevant_crates(
+ &self,
+ file_id: FileId,
+ ) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>>;
}
/// Database which stores all significant input facts: source code and project
@@ -99,10 +103,16 @@ pub trait SourceDatabaseExt: SourceDatabase {
#[salsa::input]
fn source_root(&self, id: SourceRootId) -> Arc<SourceRoot>;
- fn source_root_crates(&self, id: SourceRootId) -> Arc<FxHashSet<CrateId>>;
+ fn source_root_crates(
+ &self,
+ id: SourceRootId,
+ ) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>>;
}
-fn source_root_crates(db: &dyn SourceDatabaseExt, id: SourceRootId) -> Arc<FxHashSet<CrateId>> {
+fn source_root_crates(
+ db: &dyn SourceDatabaseExt,
+ id: SourceRootId,
+) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>> {
let graph = db.crate_graph();
let res = graph
.iter()
@@ -128,7 +138,10 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
source_root.resolve_path(path)
}
- fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
+ fn relevant_crates(
+ &self,
+ file_id: FileId,
+ ) -> Arc<IndexSet<CrateId, BuildHasherDefault<FxHasher>>> {
let _p = profile::span("relevant_crates");
let source_root = self.0.file_source_root(file_id);
self.0.source_root_crates(source_root)