From 9fac9c740d0f57826b7327a8bd338fe21a89837f Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Thu, 21 Nov 2024 16:00:51 +0100 Subject: [PATCH] Pass correct argument to rustc -Z ls Behavior was changed back in rustc 1.74. Fixes #2290 --- src/compiler/rust.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index 05206f01a4..e28774893e 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -2372,7 +2372,7 @@ impl RlibDepReader { trace!("Discovering dependencies of {}", rlib.display()); let mut cmd = process::Command::new(&self.executable); - cmd.args(["-Z", "ls"]) + cmd.args(["-Z", "ls=root"]) .arg(rlib) .env_clear() .envs(env_vars.to_vec()) @@ -3108,6 +3108,19 @@ proc_macro false assert_eq!(res[2], "lucet_runtime_macros"); } + #[cfg(feature = "dist-client")] + #[test] + fn test_rlib_dep_reader() { + let cargo_home = std::env::var("CARGO_HOME"); + assert!(cargo_home.is_ok()); + + let mut rustc_path = PathBuf::from(cargo_home.unwrap()); + rustc_path.push("bin"); + rustc_path.push("rustc"); + let rlib_dep_reader = RlibDepReader::new_with_check(rustc_path, &[]); + assert!(rlib_dep_reader.is_ok()); + } + fn mock_dep_info(creator: &Arc>, dep_srcs: &[&str]) { // Mock the `rustc --emit=dep-info` process by writing // a dep-info file.