From b51ca0e83e48eaad0830f2bf1eeb64f65d9c3a4a Mon Sep 17 00:00:00 2001 From: bors Date: Fri, 20 Aug 2021 22:23:14 +0000 Subject: [PATCH] Auto merge of #9814 - ehuss:move-tmp, r=alexcrichton Move `tmp` test directory. The `tmp` directory added in #9375 was placed within the profile directory (such as `target/debug/tmp` or `target/release/tmp`). This causes problems for any cargo target (binary, test, etc.) with the name `tmp` as there is a name collision. This PR attempts to address that by moving the `tmp` directory to the root of the target directory (`target/tmp`), and reserving the profile name "tmp". Fixes #9783 --- src/cargo/core/compiler/layout.rs | 2 +- src/cargo/util/toml/mod.rs | 1 + src/doc/src/reference/environment-variables.md | 1 - tests/testsuite/build.rs | 5 ++++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cargo/core/compiler/layout.rs b/src/cargo/core/compiler/layout.rs index b5d7dea6e64..e3dd6eaf13b 100644 --- a/src/cargo/core/compiler/layout.rs +++ b/src/cargo/core/compiler/layout.rs @@ -172,7 +172,7 @@ impl Layout { fingerprint: dest.join(".fingerprint"), examples: dest.join("examples"), doc: root.join("doc"), - tmp: dest.join("tmp"), + tmp: root.join("tmp"), root, dest, _lock: lock, diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index ebc1c12bb65..2d2788659ac 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -627,6 +627,7 @@ impl TomlProfile { | "rust" | "rustc" | "rustdoc" + | "tmp" | "uninstall" ) || lower_name.starts_with("cargo") { diff --git a/src/doc/src/reference/environment-variables.md b/src/doc/src/reference/environment-variables.md index e3cca01b6f2..bdbf368ae03 100644 --- a/src/doc/src/reference/environment-variables.md +++ b/src/doc/src/reference/environment-variables.md @@ -233,7 +233,6 @@ corresponding environment variable is set to the empty string, `""`. where integration tests or benchmarks are free to put any data needed by the tests/benches. Cargo initially creates this directory but doesn't manage its content in any way, this is the responsibility of the test code. - There are separate directories for `debug` and `release` profiles. [integration test]: cargo-targets.md#integration-tests [`env` macro]: ../../std/macro.env.html diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index ae31707a7d5..8417586a942 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -1377,7 +1377,10 @@ fn crate_env_vars() { let tmpdir: PathBuf = tmp.unwrap().into(); let exe: PathBuf = env::current_exe().unwrap().into(); - let mut expected: PathBuf = exe.parent().unwrap().parent().unwrap().into(); + let mut expected: PathBuf = exe.parent().unwrap() + .parent().unwrap() + .parent().unwrap() + .into(); expected.push("tmp"); assert_eq!(tmpdir, expected);