diff --git a/Cargo.lock b/Cargo.lock index befd88a5a..9b3ab7613 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4432,6 +4432,7 @@ version = "0.1.50" dependencies = [ "criterion", "ide-core", + "ide-heap", "libc", "memmap2", "proptest", @@ -4547,6 +4548,7 @@ dependencies = [ "dunce", "globset", "ide-core", + "ide-index", "ide-language", "ignore", "nucleo-matcher", diff --git a/crates/ide-heap/Cargo.toml b/crates/ide-heap/Cargo.toml index 745117087..60a6e2b52 100644 --- a/crates/ide-heap/Cargo.toml +++ b/crates/ide-heap/Cargo.toml @@ -18,7 +18,13 @@ uuid.workspace = true [target.'cfg(unix)'.dependencies] libc = "0.2" +[features] +# `testing`: the `.hprof` fixture builders, for tests and benches of this crate and of crates built on it. +testing = [] + [dev-dependencies] +# Self dev-dependency: turns `testing` on for this crate's benches, so a plain `cargo bench -p ide-heap` builds them. +ide-heap = { workspace = true, features = ["testing"] } criterion = { version = "0.5", default-features = false } proptest.workspace = true tempfile.workspace = true diff --git a/crates/ide-heap/src/lib.rs b/crates/ide-heap/src/lib.rs index 91a8ba9ad..fdd0056a3 100644 --- a/crates/ide-heap/src/lib.rs +++ b/crates/ide-heap/src/lib.rs @@ -20,7 +20,7 @@ mod strings; #[cfg(test)] mod test_index; /// Fixture builders shared by this crate's tests and by dependants' tests and benches; not API. -#[doc(hidden)] +#[cfg(any(test, feature = "testing"))] pub mod testing; pub use analysis::{AnalyzeOptions, analyze}; diff --git a/crates/ide-host/Cargo.toml b/crates/ide-host/Cargo.toml index d74b93e73..87fc1b81a 100644 --- a/crates/ide-host/Cargo.toml +++ b/crates/ide-host/Cargo.toml @@ -78,6 +78,7 @@ zip.workspace = true quick-xml = "0.42" [dev-dependencies] +ide-heap = { workspace = true, features = ["testing"] } ide-ssh = { workspace = true, features = ["testing"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-util", "test-util"] } criterion = { version = "0.5", default-features = false } diff --git a/crates/ide-index/Cargo.toml b/crates/ide-index/Cargo.toml index 29d8a6163..99470c9c9 100644 --- a/crates/ide-index/Cargo.toml +++ b/crates/ide-index/Cargo.toml @@ -24,7 +24,13 @@ postcard = { version = "1.1", default-features = false, features = ["use-std"] } [build-dependencies] blake3.workspace = true +[features] +# `bench-support`: a synthetic in-memory index for `benches/index.rs`. +bench-support = [] + [dev-dependencies] +# Self dev-dependency: turns `bench-support` on for this crate's benches, so a plain `cargo bench -p ide-index` builds them. +ide-index = { workspace = true, features = ["bench-support"] } tempfile.workspace = true criterion = { version = "0.5", default-features = false } diff --git a/crates/ide-index/src/lib.rs b/crates/ide-index/src/lib.rs index 8e8a651a9..ed33addf2 100644 --- a/crates/ide-index/src/lib.rs +++ b/crates/ide-index/src/lib.rs @@ -536,7 +536,7 @@ impl Drop for ProjectIndex { mod tests; /// Synthetic in-memory index for benchmarks (`benches/index.rs`); not a stable API. -#[doc(hidden)] +#[cfg(any(test, feature = "bench-support"))] pub mod bench_support { use super::*; use crate::data::{FileEntry, FileRecord, IndexData, StoredSymbol};