diff --git a/Cargo.lock b/Cargo.lock index 98f06f53ad0..c18ee2f44dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -619,7 +619,8 @@ dependencies = [ "ra_syntax 0.1.0", "rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa 0.4.1 (git+https://github.com/salsa-rs/salsa?rev=20c9fbf)", "test_utils 0.1.0", ] @@ -845,13 +846,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "salsa" version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/salsa-rs/salsa?rev=20c9fbf#20c9fbf45c0201e39cfeda4c939160ad1c35132c" dependencies = [ "derive-new 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1350,7 +1352,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" -"checksum salsa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7a4bcb8e4e81d092709a98130025666d255c8821970dcb9347d05f928e3d505" +"checksum salsa 0.4.1 (git+https://github.com/salsa-rs/salsa?rev=20c9fbf)" = "" "checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml index 4481e98d64e..233f34e34b0 100644 --- a/crates/ra_analysis/Cargo.toml +++ b/crates/ra_analysis/Cargo.toml @@ -15,7 +15,8 @@ fst = "0.3.1" im = "12.0.0" ra_syntax = { path = "../ra_syntax" } ra_editor = { path = "../ra_editor" } -salsa = "0.4.1" +salsa = { git = "https://github.com/salsa-rs/salsa", rev = "20c9fbf" } +rustc-hash = "1.0" [dev-dependencies] test_utils = { path = "../test_utils" } diff --git a/crates/ra_analysis/src/db/mod.rs b/crates/ra_analysis/src/db/mod.rs index c54d502529b..c84bfa7a887 100644 --- a/crates/ra_analysis/src/db/mod.rs +++ b/crates/ra_analysis/src/db/mod.rs @@ -2,9 +2,9 @@ use std::{ fmt, sync::Arc, hash::{Hash, Hasher}, - collections::HashSet, }; use salsa; +use rustc_hash::FxHashSet; use ra_syntax::File; use ra_editor::{LineIndex}; use crate::{ @@ -63,7 +63,7 @@ salsa::query_group! { #[derive(Default, Debug)] pub(crate) struct FileSet { - pub(crate) files: HashSet, + pub(crate) files: FxHashSet, pub(crate) resolver: FileResolverImp, } diff --git a/crates/ra_analysis/src/roots.rs b/crates/ra_analysis/src/roots.rs index 908f49b0a52..692a07ccd83 100644 --- a/crates/ra_analysis/src/roots.rs +++ b/crates/ra_analysis/src/roots.rs @@ -1,5 +1,4 @@ use std::{ - collections::{HashMap, HashSet}, sync::Arc, panic, }; @@ -8,6 +7,7 @@ use parking_lot::RwLock; use once_cell::sync::OnceCell; use rayon::prelude::*; use salsa::Database; +use rustc_hash::{FxHashMap, FxHashSet}; use ra_editor::LineIndex; use ra_syntax::File; @@ -40,8 +40,8 @@ impl WritableSourceRoot { file_resolver: Option, ) -> WritableSourceRoot { let db = self.db.write(); - let mut changed = HashSet::new(); - let mut removed = HashSet::new(); + let mut changed = FxHashSet::default(); + let mut removed = FxHashSet::default(); for (file_id, text) in changes { match text { None => { @@ -55,7 +55,7 @@ impl WritableSourceRoot { } } let file_set = db.file_set(()); - let mut files: HashSet = file_set + let mut files: FxHashSet = file_set .files .clone(); for file_id in removed {