You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Set working directory for cargo metadata and cargo clean to ensure config discovery (#646)
* tests: Add `cargo_config_discovery` test
* fix: set working directory for cargo to ensure config discovery
Set `WORKING_DIRECTORY` for all `cargo` invocations to the manifest's directory, matching the existing behavior for `cargo build`. This ensures that Cargo properly discovers configuration files like `.cargo/config.toml` and `toolchain.toml` by walking upward from the manifest directory, rather than from CMake's current working directory.
Updated comments to clarify that Cargo searches for configuration files by walking upward from the current directory.
* test fix: build executable for `cargo_config_discovery_run_cargo_config_discovery`.
* test fix: adjust registry alias / dependency for older toolchain
* test fix: ensure `cargo-clean` waits until `*_run_${exe}` completes.
* test fix: shorten name to `config_discovery` to avoid Windows path limit
This test verifies that `cargo` correctly discovers configuration files such as `.cargo/config.toml` and `toolchain.toml` in the source tree.
4
+
5
+
## What's Being Tested
6
+
7
+
Cargo discovers configuration files by searching the current working directory and its parent directories. Therefore, Corrosion must set the correct `WORKING_DIRECTORY` for all `cargo` invocations.
8
+
9
+
## How the Test Works
10
+
11
+
The test uses a `.cargo/config.toml` that defines a custom registry alias `my-registry`. A dependency in `Cargo.toml` references this alias via `registry = "my-registry"`.
12
+
13
+
If `cargo` does not find `.cargo/config.toml`, the `registry = "my-registry"` entry will cause an error during manifest parsing.
0 commit comments