Skip to content

Commit 260e996

Browse files
committed
Auto merge of #14733 - azdavis:master, r=matklad
Make line-index a lib, use nohash_hasher These seem like they are not specific to rust-analyzer and could be pulled out to their own libraries. So I did. azdavis/millet#31
2 parents a10fd83 + 60056b8 commit 260e996

32 files changed

+481
-474
lines changed

Cargo.lock

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,17 @@ toolchain = { path = "./crates/toolchain", version = "0.0.0" }
7474
tt = { path = "./crates/tt", version = "0.0.0" }
7575
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
7676
vfs = { path = "./crates/vfs", version = "0.0.0" }
77+
line-index = { version = "0.1.0-pre.1", path = "./lib/line-index" }
7778

7879
# non-local crates
79-
smallvec = { version = "1.10.0", features = ["const_new", "union", "const_generics"] }
80+
smallvec = { version = "1.10.0", features = [
81+
"const_new",
82+
"union",
83+
"const_generics",
84+
] }
8085
smol_str = "0.2.0"
86+
nohash-hasher = "0.2.0"
87+
text-size = "1.1.0"
8188
# the following crates are pinned to prevent us from pulling in syn 2 until all our dependencies have moved
8289
serde = { version = "=1.0.156", features = ["derive"] }
8390
serde_json = "1.0.94"

crates/hir-ty/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ chalk-derive = "0.89.0"
2929
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
3030
once_cell = "1.17.0"
3131
triomphe.workspace = true
32+
nohash-hasher.workspace = true
3233
typed-arena = "2.0.1"
3334
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }
3435

crates/hir-ty/src/test_db.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use base_db::{
88
};
99
use hir_def::{db::DefDatabase, ModuleId};
1010
use hir_expand::db::ExpandDatabase;
11+
use nohash_hasher::IntMap;
1112
use rustc_hash::FxHashSet;
12-
use stdx::hash::NoHashHashMap;
1313
use syntax::TextRange;
1414
use test_utils::extract_annotations;
1515
use triomphe::Arc;
@@ -102,7 +102,7 @@ impl TestDB {
102102
self.module_for_file_opt(file_id).unwrap()
103103
}
104104

105-
pub(crate) fn extract_annotations(&self) -> NoHashHashMap<FileId, Vec<(TextRange, String)>> {
105+
pub(crate) fn extract_annotations(&self) -> IntMap<FileId, Vec<(TextRange, String)>> {
106106
let mut files = Vec::new();
107107
let crate_graph = self.crate_graph();
108108
for krate in crate_graph.iter() {

crates/ide-db/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ arrayvec = "0.7.2"
2424
indexmap = "1.9.1"
2525
memchr = "2.5.0"
2626
triomphe.workspace = true
27+
nohash-hasher.workspace = true
2728

2829
# local deps
2930
base-db.workspace = true
@@ -37,6 +38,8 @@ text-edit.workspace = true
3738
# something from some `hir-xxx` subpackage, reexport the API via `hir`.
3839
hir.workspace = true
3940

41+
line-index.workspace = true
42+
4043
[dev-dependencies]
4144
expect-test = "1.4.0"
4245
oorandom = "11.1.3"

crates/ide-db/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub mod famous_defs;
1313
pub mod helpers;
1414
pub mod items_locator;
1515
pub mod label;
16-
pub mod line_index;
1716
pub mod path_transform;
1817
pub mod rename;
1918
pub mod rust_doc;
@@ -55,6 +54,8 @@ use triomphe::Arc;
5554
use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase};
5655
pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
5756

57+
pub use ::line_index;
58+
5859
/// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience.
5960
pub use base_db;
6061

@@ -414,4 +415,5 @@ impl SnippetCap {
414415
#[cfg(test)]
415416
mod tests {
416417
mod sourcegen_lints;
418+
mod line_index;
417419
}

0 commit comments

Comments
 (0)