From 2971b6e709144a2e8268c7769d2c4831063f29c2 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 9 Aug 2026 18:51:00 -0400 Subject: [PATCH] Fixed cross-compile bug on Windows due to reorg. --- crates/quicksearch-core/src/file_handling/counting.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/quicksearch-core/src/file_handling/counting.rs b/crates/quicksearch-core/src/file_handling/counting.rs index 70a2a7d..53d2e7e 100644 --- a/crates/quicksearch-core/src/file_handling/counting.rs +++ b/crates/quicksearch-core/src/file_handling/counting.rs @@ -104,12 +104,20 @@ fn count_find_pipe_wc( /// Count tree entries with a plain directory walk — the oracle /// [`count_tree_entries_win32`] is tested against. -#[cfg(windows)] +/// +/// Gated on `test` as well as `windows` because its only caller is a +/// Windows-only test: under plain `cargo build --target …-windows-gnu` it +/// would otherwise compile as dead code. The `walkdir` import is local for the +/// same reason the rest of this module's platform imports are — a file-level +/// one is invisible to the host that cannot compile the branch using it, which +/// is exactly how it went missing when this module was split out. +#[cfg(all(windows, test))] fn count_tree_entries_walkdir( path: &str, cancel: &std::sync::atomic::AtomicBool, ) -> Result { use std::sync::atomic::Ordering; + use walkdir::WalkDir; let mut n = 0usize; // Unreadable subtrees are skipped rather than fatal: this is a progress