From 2e60de48567614516790722713a8f94cfd31fc7e 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index 05206f01a4..a447e17957 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()) @@ -3582,4 +3582,16 @@ proc_macro false assert_eq!(h.profile, Some("foo-a1b6419f8321841f.profraw".into())); } + + #[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()); + } }