From c3f6b8461194603f491e2a0ab70ff0ddae3b847c Mon Sep 17 00:00:00 2001 From: David Havas Date: Mon, 16 Dec 2024 22:51:22 +0100 Subject: [PATCH] Revert "Do not cache rustc info in deps resolver (#3107)" This reverts commit 834df356aaa72fd16fe275cd9eb197e9dd3e6db6. --- .../src/metadata/cargo_tree_resolver.rs | 1 - .../tests/cargo_integration_test.rs | 22 ++++++------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/crate_universe/src/metadata/cargo_tree_resolver.rs b/crate_universe/src/metadata/cargo_tree_resolver.rs index 27c5c03155..bdcfa2b31a 100644 --- a/crate_universe/src/metadata/cargo_tree_resolver.rs +++ b/crate_universe/src/metadata/cargo_tree_resolver.rs @@ -150,7 +150,6 @@ impl TreeResolver { // host triple instead of the host triple detected by rustc. .env("RUSTC_WRAPPER", rustc_wrapper) .env("HOST_TRIPLE", host_triple) - .env("CARGO_CACHE_RUSTC_INFO", "0") .current_dir(manifest_path.parent().expect("All manifests should have a valid parent.")) .arg("tree") .arg("--manifest-path") diff --git a/crate_universe/tests/cargo_integration_test.rs b/crate_universe/tests/cargo_integration_test.rs index d8bf4f1f51..49b739b8d2 100644 --- a/crate_universe/tests/cargo_integration_test.rs +++ b/crate_universe/tests/cargo_integration_test.rs @@ -526,24 +526,16 @@ fn host_specific_build_deps() { } let r = runfiles::Runfiles::create().unwrap(); - - let src_cargo_toml = runfiles::rlocation!( - r, - "rules_rust/crate_universe/test_data/metadata/host_specific_build_deps/Cargo.toml" - ) - .unwrap(); - - // Put Cargo.toml into writable directory structure and create target/ directory to verify that - // cargo does not incorrectly cache rustc info in target/.rustc_info.json file. - let scratch = tempfile::tempdir().unwrap(); - let cargo_toml = scratch.path().join("Cargo.toml"); - fs::copy(src_cargo_toml, &cargo_toml).unwrap(); - fs::create_dir(scratch.path().join("target")).unwrap(); - let metadata = run( "host_specific_build_deps", HashMap::from([( - cargo_toml.to_string_lossy().to_string(), + runfiles::rlocation!( + r, + "rules_rust/crate_universe/test_data/metadata/host_specific_build_deps/Cargo.toml" + ) + .unwrap() + .to_string_lossy() + .to_string(), "//:test_input".to_string(), )]), "rules_rust/crate_universe/test_data/metadata/host_specific_build_deps/Cargo.lock",