From 783be06009e10a3fa1cd65485ae655891644e714 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Fri, 13 Nov 2026 21:16:28 +0000 Subject: [PATCH] fix: locate the test UDF library under Cargo's Rust 1.100 build layout (#7617) Rust 1.100 splits the build script output directory into /, so the fixed-depth ancestor lookup in native/core/build.rs resolved COMET_TEST_UDFS_LIB to target//build instead of target/. Find the profile directory as the parent of the nearest build ancestor of OUT_DIR, which works under both layouts. (cherry picked from commit d504163b1b40db0c89d4db747f6833a9c9d578b6) --- native/core/build.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/native/core/build.rs b/native/core/build.rs index da42b85a5c1..ad470a45453 100644 --- a/native/core/build.rs +++ b/native/core/build.rs @@ -46,13 +46,15 @@ fn main() { // DEP_<...>_OUT_DIR for non-rlib crates, so we compute the path // from OUT_DIR. if let Ok(out_dir) = std::env::var("OUT_DIR") { - let out_path = std::path::PathBuf::from(out_dir); - // OUT_DIR is .../target//build//out - let target_profile_dir = out_path + // OUT_DIR is .../target//build//out with Cargo's + // classic layout and .../target//build///out with + // the layout that became the default in Rust 1.100. The depth differs, + // so find the profile directory as the parent of the nearest `build`. + let target_profile_dir = Path::new(&out_dir) .ancestors() - .nth(3) - .map(|p| p.to_path_buf()) - .unwrap_or_default(); + .find(|p| p.file_name().is_some_and(|name| name == "build")) + .and_then(Path::parent) + .unwrap_or_else(|| panic!("OUT_DIR {out_dir} is not inside a `build` directory")); let dylib_ext = if cfg!(target_os = "macos") { "dylib" } else if cfg!(target_os = "windows") {