Unnamed repository; edit this file 'description' to name the repository.
Depend on nohash-hasher individually
Ariel Davis 2023-05-06
parent 1d678cf · commit 4a1922f
-rw-r--r--Cargo.lock7
-rw-r--r--crates/hir-ty/Cargo.toml1
-rw-r--r--crates/hir-ty/src/test_db.rs4
-rw-r--r--crates/ide-db/Cargo.toml1
-rw-r--r--crates/ide-db/src/search.rs18
-rw-r--r--crates/ide-db/src/source_change.rs14
-rw-r--r--crates/ide-ssr/Cargo.toml1
-rw-r--r--crates/ide-ssr/src/lib.rs6
-rw-r--r--crates/ide/Cargo.toml1
-rw-r--r--crates/ide/src/references.rs4
-rw-r--r--crates/rust-analyzer/Cargo.toml6
-rw-r--r--crates/rust-analyzer/src/diagnostics.rs14
-rw-r--r--crates/rust-analyzer/src/global_state.rs8
-rw-r--r--crates/stdx/Cargo.toml1
-rw-r--r--crates/stdx/src/hash.rs5
-rw-r--r--crates/stdx/src/lib.rs1
-rw-r--r--crates/vfs/Cargo.toml1
-rw-r--r--crates/vfs/src/file_set.rs4
-rw-r--r--crates/vfs/src/lib.rs2
-rw-r--r--lib/line-index/src/lib.rs6
20 files changed, 53 insertions, 52 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f7179e9424..f20cba9865 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -587,6 +587,7 @@ dependencies = [
"itertools",
"la-arena",
"limit",
+ "nohash-hasher",
"once_cell",
"profile",
"project-model",
@@ -650,6 +651,7 @@ dependencies = [
"ide-diagnostics",
"ide-ssr",
"itertools",
+ "nohash-hasher",
"oorandom",
"profile",
"pulldown-cmark",
@@ -719,6 +721,7 @@ dependencies = [
"limit",
"line-index",
"memchr",
+ "nohash-hasher",
"once_cell",
"oorandom",
"parser",
@@ -764,6 +767,7 @@ dependencies = [
"hir",
"ide-db",
"itertools",
+ "nohash-hasher",
"parser",
"stdx",
"syntax",
@@ -1485,6 +1489,7 @@ dependencies = [
"mbe",
"mimalloc",
"mio",
+ "nohash-hasher",
"num_cpus",
"oorandom",
"parking_lot 0.12.1",
@@ -1708,7 +1713,6 @@ dependencies = [
"backtrace",
"libc",
"miow",
- "nohash-hasher",
"winapi",
]
@@ -2066,6 +2070,7 @@ version = "0.0.0"
dependencies = [
"fst",
"indexmap",
+ "nohash-hasher",
"paths",
"rustc-hash",
"stdx",
diff --git a/crates/hir-ty/Cargo.toml b/crates/hir-ty/Cargo.toml
index 51d69d103a..6ca0dbb850 100644
--- a/crates/hir-ty/Cargo.toml
+++ b/crates/hir-ty/Cargo.toml
@@ -29,6 +29,7 @@ chalk-derive = "0.89.0"
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
once_cell = "1.17.0"
triomphe.workspace = true
+nohash-hasher.workspace = true
typed-arena = "2.0.1"
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }
diff --git a/crates/hir-ty/src/test_db.rs b/crates/hir-ty/src/test_db.rs
index 1276a4c5e1..7d19e0a191 100644
--- a/crates/hir-ty/src/test_db.rs
+++ b/crates/hir-ty/src/test_db.rs
@@ -8,8 +8,8 @@ use base_db::{
};
use hir_def::{db::DefDatabase, ModuleId};
use hir_expand::db::ExpandDatabase;
+use nohash_hasher::IntMap;
use rustc_hash::FxHashSet;
-use stdx::hash::NoHashHashMap;
use syntax::TextRange;
use test_utils::extract_annotations;
use triomphe::Arc;
@@ -102,7 +102,7 @@ impl TestDB {
self.module_for_file_opt(file_id).unwrap()
}
- pub(crate) fn extract_annotations(&self) -> NoHashHashMap<FileId, Vec<(TextRange, String)>> {
+ pub(crate) fn extract_annotations(&self) -> IntMap<FileId, Vec<(TextRange, String)>> {
let mut files = Vec::new();
let crate_graph = self.crate_graph();
for krate in crate_graph.iter() {
diff --git a/crates/ide-db/Cargo.toml b/crates/ide-db/Cargo.toml
index a0b79d1764..4e75dc4dba 100644
--- a/crates/ide-db/Cargo.toml
+++ b/crates/ide-db/Cargo.toml
@@ -24,6 +24,7 @@ arrayvec = "0.7.2"
indexmap = "1.9.1"
memchr = "2.5.0"
triomphe.workspace = true
+nohash-hasher.workspace = true
# local deps
base-db.workspace = true
diff --git a/crates/ide-db/src/search.rs b/crates/ide-db/src/search.rs
index f58a96d595..9d00c71709 100644
--- a/crates/ide-db/src/search.rs
+++ b/crates/ide-db/src/search.rs
@@ -11,9 +11,9 @@ use hir::{
AsAssocItem, DefWithBody, HasAttrs, HasSource, InFile, ModuleSource, Semantics, Visibility,
};
use memchr::memmem::Finder;
+use nohash_hasher::IntMap;
use once_cell::unsync::Lazy;
use parser::SyntaxKind;
-use stdx::hash::NoHashHashMap;
use syntax::{ast, match_ast, AstNode, TextRange, TextSize};
use triomphe::Arc;
@@ -25,7 +25,7 @@ use crate::{
#[derive(Debug, Default, Clone)]
pub struct UsageSearchResult {
- pub references: NoHashHashMap<FileId, Vec<FileReference>>,
+ pub references: IntMap<FileId, Vec<FileReference>>,
}
impl UsageSearchResult {
@@ -50,7 +50,7 @@ impl UsageSearchResult {
impl IntoIterator for UsageSearchResult {
type Item = (FileId, Vec<FileReference>);
- type IntoIter = <NoHashHashMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
+ type IntoIter = <IntMap<FileId, Vec<FileReference>> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.references.into_iter()
@@ -84,17 +84,17 @@ pub enum ReferenceCategory {
/// e.g. for things like local variables.
#[derive(Clone, Debug)]
pub struct SearchScope {
- entries: NoHashHashMap<FileId, Option<TextRange>>,
+ entries: IntMap<FileId, Option<TextRange>>,
}
impl SearchScope {
- fn new(entries: NoHashHashMap<FileId, Option<TextRange>>) -> SearchScope {
+ fn new(entries: IntMap<FileId, Option<TextRange>>) -> SearchScope {
SearchScope { entries }
}
/// Build a search scope spanning the entire crate graph of files.
fn crate_graph(db: &RootDatabase) -> SearchScope {
- let mut entries = NoHashHashMap::default();
+ let mut entries = IntMap::default();
let graph = db.crate_graph();
for krate in graph.iter() {
@@ -108,7 +108,7 @@ impl SearchScope {
/// Build a search scope spanning all the reverse dependencies of the given crate.
fn reverse_dependencies(db: &RootDatabase, of: hir::Crate) -> SearchScope {
- let mut entries = NoHashHashMap::default();
+ let mut entries = IntMap::default();
for rev_dep in of.transitive_reverse_dependencies(db) {
let root_file = rev_dep.root_file(db);
let source_root_id = db.file_source_root(root_file);
@@ -128,7 +128,7 @@ impl SearchScope {
/// Build a search scope spanning the given module and all its submodules.
fn module_and_children(db: &RootDatabase, module: hir::Module) -> SearchScope {
- let mut entries = NoHashHashMap::default();
+ let mut entries = IntMap::default();
let (file_id, range) = {
let InFile { file_id, value } = module.definition_source(db);
@@ -161,7 +161,7 @@ impl SearchScope {
/// Build an empty search scope.
pub fn empty() -> SearchScope {
- SearchScope::new(NoHashHashMap::default())
+ SearchScope::new(IntMap::default())
}
/// Build a empty search scope spanning the given file.
diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs
index 5a3e352b2e..061fb0f05c 100644
--- a/crates/ide-db/src/source_change.rs
+++ b/crates/ide-db/src/source_change.rs
@@ -5,16 +5,16 @@
use std::{collections::hash_map::Entry, iter, mem};
+use crate::SnippetCap;
use base_db::{AnchoredPathBuf, FileId};
-use stdx::{hash::NoHashHashMap, never};
+use nohash_hasher::IntMap;
+use stdx::never;
use syntax::{algo, ast, ted, AstNode, SyntaxNode, SyntaxNodePtr, TextRange, TextSize};
use text_edit::{TextEdit, TextEditBuilder};
-use crate::SnippetCap;
-
#[derive(Default, Debug, Clone)]
pub struct SourceChange {
- pub source_file_edits: NoHashHashMap<FileId, TextEdit>,
+ pub source_file_edits: IntMap<FileId, TextEdit>,
pub file_system_edits: Vec<FileSystemEdit>,
pub is_snippet: bool,
}
@@ -23,7 +23,7 @@ impl SourceChange {
/// Creates a new SourceChange with the given label
/// from the edits.
pub fn from_edits(
- source_file_edits: NoHashHashMap<FileId, TextEdit>,
+ source_file_edits: IntMap<FileId, TextEdit>,
file_system_edits: Vec<FileSystemEdit>,
) -> Self {
SourceChange { source_file_edits, file_system_edits, is_snippet: false }
@@ -77,8 +77,8 @@ impl Extend<FileSystemEdit> for SourceChange {
}
}
-impl From<NoHashHashMap<FileId, TextEdit>> for SourceChange {
- fn from(source_file_edits: NoHashHashMap<FileId, TextEdit>) -> SourceChange {
+impl From<IntMap<FileId, TextEdit>> for SourceChange {
+ fn from(source_file_edits: IntMap<FileId, TextEdit>) -> SourceChange {
SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false }
}
}
diff --git a/crates/ide-ssr/Cargo.toml b/crates/ide-ssr/Cargo.toml
index b8625fc1be..70ed6dea5b 100644
--- a/crates/ide-ssr/Cargo.toml
+++ b/crates/ide-ssr/Cargo.toml
@@ -16,6 +16,7 @@ doctest = false
cov-mark = "2.0.0-pre.1"
itertools = "0.10.5"
triomphe.workspace = true
+nohash-hasher.workspace = true
# local deps
hir.workspace = true
diff --git a/crates/ide-ssr/src/lib.rs b/crates/ide-ssr/src/lib.rs
index a1945087d7..f51a9547a5 100644
--- a/crates/ide-ssr/src/lib.rs
+++ b/crates/ide-ssr/src/lib.rs
@@ -87,8 +87,8 @@ pub use crate::{errors::SsrError, from_comment::ssr_from_comment, matching::Matc
use crate::{errors::bail, matching::MatchFailureReason};
use hir::Semantics;
use ide_db::base_db::{FileId, FilePosition, FileRange};
+use nohash_hasher::IntMap;
use resolving::ResolvedRule;
-use stdx::hash::NoHashHashMap;
use syntax::{ast, AstNode, SyntaxNode, TextRange};
use text_edit::TextEdit;
@@ -168,9 +168,9 @@ impl<'db> MatchFinder<'db> {
}
/// Finds matches for all added rules and returns edits for all found matches.
- pub fn edits(&self) -> NoHashHashMap<FileId, TextEdit> {
+ pub fn edits(&self) -> IntMap<FileId, TextEdit> {
use ide_db::base_db::SourceDatabaseExt;
- let mut matches_by_file = NoHashHashMap::default();
+ let mut matches_by_file = IntMap::default();
for m in self.matches().matches {
matches_by_file
.entry(m.range.file_id)
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml
index c3dcb60490..2aee203c4e 100644
--- a/crates/ide/Cargo.toml
+++ b/crates/ide/Cargo.toml
@@ -24,6 +24,7 @@ url = "2.3.1"
dot = "0.1.4"
smallvec.workspace = true
triomphe.workspace = true
+nohash-hasher.workspace = true
# local deps
cfg.workspace = true
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index b8e05d4f62..291b1a349b 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -17,7 +17,7 @@ use ide_db::{
RootDatabase,
};
use itertools::Itertools;
-use stdx::hash::NoHashHashMap;
+use nohash_hasher::IntMap;
use syntax::{
algo::find_node_at_offset,
ast::{self, HasName},
@@ -31,7 +31,7 @@ use crate::{FilePosition, NavigationTarget, TryToNav};
#[derive(Debug, Clone)]
pub struct ReferenceSearchResult {
pub declaration: Option<Declaration>,
- pub references: NoHashHashMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
+ pub references: IntMap<FileId, Vec<(TextRange, Option<ReferenceCategory>)>>,
}
#[derive(Debug, Clone)]
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index c7c2e34127..ae5b8e4c42 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -46,6 +46,7 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features =
tracing-log = "0.1.3"
tracing-tree = "0.2.1"
triomphe.workspace = true
+nohash-hasher.workspace = true
always-assert = "0.1.2"
# These dependencies are unused, but we pin them to a version here to restrict them for our transitive dependencies
@@ -95,7 +96,4 @@ mbe.workspace = true
[features]
jemalloc = ["jemallocator", "profile/jemalloc"]
force-always-assert = ["always-assert/force"]
-in-rust-tree = [
- "ide/in-rust-tree",
- "syntax/in-rust-tree",
-]
+in-rust-tree = ["ide/in-rust-tree", "syntax/in-rust-tree"]
diff --git a/crates/rust-analyzer/src/diagnostics.rs b/crates/rust-analyzer/src/diagnostics.rs
index 2edb394a0b..33422fd058 100644
--- a/crates/rust-analyzer/src/diagnostics.rs
+++ b/crates/rust-analyzer/src/diagnostics.rs
@@ -5,12 +5,12 @@ use std::mem;
use ide::FileId;
use ide_db::FxHashMap;
-use stdx::hash::{NoHashHashMap, NoHashHashSet};
+use nohash_hasher::{IntMap, IntSet};
use triomphe::Arc;
use crate::lsp_ext;
-pub(crate) type CheckFixes = Arc<NoHashHashMap<usize, NoHashHashMap<FileId, Vec<Fix>>>>;
+pub(crate) type CheckFixes = Arc<IntMap<usize, IntMap<FileId, Vec<Fix>>>>;
#[derive(Debug, Default, Clone)]
pub struct DiagnosticsMapConfig {
@@ -21,12 +21,12 @@ pub struct DiagnosticsMapConfig {
#[derive(Debug, Default, Clone)]
pub(crate) struct DiagnosticCollection {
- // FIXME: should be NoHashHashMap<FileId, Vec<ra_id::Diagnostic>>
- pub(crate) native: NoHashHashMap<FileId, Vec<lsp_types::Diagnostic>>,
+ // FIXME: should be IntMap<FileId, Vec<ra_id::Diagnostic>>
+ pub(crate) native: IntMap<FileId, Vec<lsp_types::Diagnostic>>,
// FIXME: should be Vec<flycheck::Diagnostic>
- pub(crate) check: NoHashHashMap<usize, NoHashHashMap<FileId, Vec<lsp_types::Diagnostic>>>,
+ pub(crate) check: IntMap<usize, IntMap<FileId, Vec<lsp_types::Diagnostic>>>,
pub(crate) check_fixes: CheckFixes,
- changes: NoHashHashSet<FileId>,
+ changes: IntSet<FileId>,
}
#[derive(Debug, Clone)]
@@ -106,7 +106,7 @@ impl DiagnosticCollection {
native.chain(check)
}
- pub(crate) fn take_changes(&mut self) -> Option<NoHashHashSet<FileId>> {
+ pub(crate) fn take_changes(&mut self) -> Option<IntSet<FileId>> {
if self.changes.is_empty() {
return None;
}
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 0f77eeae4a..9535d88454 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -10,11 +10,11 @@ use flycheck::FlycheckHandle;
use ide::{Analysis, AnalysisHost, Cancellable, Change, FileId};
use ide_db::base_db::{CrateId, FileLoader, ProcMacroPaths, SourceDatabase};
use lsp_types::{SemanticTokens, Url};
+use nohash_hasher::IntMap;
use parking_lot::{Mutex, RwLock};
use proc_macro_api::ProcMacroServer;
use project_model::{CargoWorkspace, ProjectWorkspace, Target, WorkspaceBuildScripts};
use rustc_hash::FxHashMap;
-use stdx::hash::NoHashHashMap;
use triomphe::Arc;
use vfs::AnchoredPathBuf;
@@ -70,7 +70,7 @@ pub(crate) struct GlobalState {
pub(crate) flycheck_sender: Sender<flycheck::Message>,
pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
- pub(crate) vfs: Arc<RwLock<(vfs::Vfs, NoHashHashMap<FileId, LineEndings>)>>,
+ pub(crate) vfs: Arc<RwLock<(vfs::Vfs, IntMap<FileId, LineEndings>)>>,
pub(crate) vfs_config_version: u32,
pub(crate) vfs_progress_config_version: u32,
pub(crate) vfs_progress_n_total: usize,
@@ -117,7 +117,7 @@ pub(crate) struct GlobalStateSnapshot {
pub(crate) check_fixes: CheckFixes,
mem_docs: MemDocs,
pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
- vfs: Arc<RwLock<(vfs::Vfs, NoHashHashMap<FileId, LineEndings>)>>,
+ vfs: Arc<RwLock<(vfs::Vfs, IntMap<FileId, LineEndings>)>>,
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
// used to signal semantic highlighting to fall back to syntax based highlighting until proc-macros have been loaded
pub(crate) proc_macros_loaded: bool,
@@ -170,7 +170,7 @@ impl GlobalState {
flycheck_sender,
flycheck_receiver,
- vfs: Arc::new(RwLock::new((vfs::Vfs::default(), NoHashHashMap::default()))),
+ vfs: Arc::new(RwLock::new((vfs::Vfs::default(), IntMap::default()))),
vfs_config_version: 0,
vfs_progress_config_version: 0,
vfs_progress_n_total: 0,
diff --git a/crates/stdx/Cargo.toml b/crates/stdx/Cargo.toml
index 3933a1f8c9..c881f2fd3f 100644
--- a/crates/stdx/Cargo.toml
+++ b/crates/stdx/Cargo.toml
@@ -15,7 +15,6 @@ doctest = false
libc = "0.2.135"
backtrace = { version = "0.3.65", optional = true }
always-assert = { version = "0.1.2", features = ["log"] }
-nohash-hasher.workspace = true
# Think twice before adding anything here
[target.'cfg(windows)'.dependencies]
diff --git a/crates/stdx/src/hash.rs b/crates/stdx/src/hash.rs
deleted file mode 100644
index 66e6c9462b..0000000000
--- a/crates/stdx/src/hash.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-//! Re-exports from [`nohash_hasher`].
-
-pub use nohash_hasher::IntMap as NoHashHashMap;
-pub use nohash_hasher::IntSet as NoHashHashSet;
-pub use nohash_hasher::IsEnabled;
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs
index 5639aaf57c..8df86e8100 100644
--- a/crates/stdx/src/lib.rs
+++ b/crates/stdx/src/lib.rs
@@ -7,7 +7,6 @@ use std::process::Command;
use std::{cmp::Ordering, ops, time::Instant};
mod macros;
-pub mod hash;
pub mod process;
pub mod panic_context;
pub mod non_empty_vec;
diff --git a/crates/vfs/Cargo.toml b/crates/vfs/Cargo.toml
index 802a300060..3ae3dc83ca 100644
--- a/crates/vfs/Cargo.toml
+++ b/crates/vfs/Cargo.toml
@@ -15,6 +15,7 @@ doctest = false
rustc-hash = "1.1.0"
fst = "0.4.7"
indexmap = "1.9.1"
+nohash-hasher.workspace = true
paths.workspace = true
stdx.workspace = true
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs
index 700aebe0b3..0392ef3ceb 100644
--- a/crates/vfs/src/file_set.rs
+++ b/crates/vfs/src/file_set.rs
@@ -5,8 +5,8 @@
use std::fmt;
use fst::{IntoStreamer, Streamer};
+use nohash_hasher::IntMap;
use rustc_hash::FxHashMap;
-use stdx::hash::NoHashHashMap;
use crate::{AnchoredPath, FileId, Vfs, VfsPath};
@@ -14,7 +14,7 @@ use crate::{AnchoredPath, FileId, Vfs, VfsPath};
#[derive(Default, Clone, Eq, PartialEq)]
pub struct FileSet {
files: FxHashMap<VfsPath, FileId>,
- paths: NoHashHashMap<FileId, VfsPath>,
+ paths: IntMap<FileId, VfsPath>,
}
impl FileSet {
diff --git a/crates/vfs/src/lib.rs b/crates/vfs/src/lib.rs
index caddd4e481..ff8a2b9673 100644
--- a/crates/vfs/src/lib.rs
+++ b/crates/vfs/src/lib.rs
@@ -63,7 +63,7 @@ pub use paths::{AbsPath, AbsPathBuf};
pub struct FileId(pub u32);
/// safe because `FileId` is a newtype of `u32`
-impl stdx::hash::IsEnabled for FileId {}
+impl nohash_hasher::IsEnabled for FileId {}
/// Storage for all files read by rust-analyzer.
///
diff --git a/lib/line-index/src/lib.rs b/lib/line-index/src/lib.rs
index 33265f0914..fa5cf1503f 100644
--- a/lib/line-index/src/lib.rs
+++ b/lib/line-index/src/lib.rs
@@ -5,7 +5,7 @@
#[cfg(test)]
mod tests;
-use nohash_hasher::IntMap as NoHashHashMap;
+use nohash_hasher::IntMap;
pub use text_size::{TextRange, TextSize};
@@ -15,7 +15,7 @@ pub struct LineIndex {
/// Offset the beginning of each line, zero-based.
newlines: Vec<TextSize>,
/// List of non-ASCII characters on each line.
- line_wide_chars: NoHashHashMap<u32, Vec<WideChar>>,
+ line_wide_chars: IntMap<u32, Vec<WideChar>>,
}
/// Line/Column information in native, utf8 format.
@@ -80,7 +80,7 @@ impl WideChar {
impl LineIndex {
/// Returns a `LineIndex` for the `text`.
pub fn new(text: &str) -> LineIndex {
- let mut line_wide_chars = NoHashHashMap::default();
+ let mut line_wide_chars = IntMap::default();
let mut wide_chars = Vec::new();
let mut newlines = Vec::with_capacity(16);