Problem
When attempting to set a relative path for rustc|rustc_wrapper|rustc_workspace_wrapper|rustdoc in the Cargo Config [build] section, the build is dependent on the working directory Cargo chooses for any given build step. As a result, running cargo build --manifest-path=my_workspace_crate/Cargo.toml from the workspace root doesn't work because part of the process looks for rustc relative to the root of the workspace, and part looks relative to the root of my_workspace_crate.
Steps
- Set a relative path for
rustc inside .cargo/config
- Attempt to build a crate where working directory is the root of that crate.
- Run
cargo clean.
- Attempt to build the same crate from a different working directory by specifying
--manifest-path or as part of a workspace.
- Observe build fails due to not being able to find
rustc.
Possible Solution(s)
Inside of src/cargo/util/config/mod.rs change CargoBuildConfig's rustc|rustc_wrapper|rustc_workspace_wrapper|rustdoc from Option<PathBuf> to Option<ConfigRelativePath>
Notes
Output of cargo version: cargo 1.44.0-nightly (8751eb3 2020-04-21)
Problem
When attempting to set a relative path for
rustc|rustc_wrapper|rustc_workspace_wrapper|rustdocin the Cargo Config[build]section, the build is dependent on the working directory Cargo chooses for any given build step. As a result, runningcargo build --manifest-path=my_workspace_crate/Cargo.tomlfrom the workspace root doesn't work because part of the process looks forrustcrelative to the root of the workspace, and part looks relative to the root ofmy_workspace_crate.Steps
rustcinside.cargo/configcargo clean.--manifest-pathor as part of a workspace.rustc.Possible Solution(s)
Inside of
src/cargo/util/config/mod.rschangeCargoBuildConfig'srustc|rustc_wrapper|rustc_workspace_wrapper|rustdocfromOption<PathBuf>toOption<ConfigRelativePath>Notes
Output of
cargo version: cargo 1.44.0-nightly (8751eb3 2020-04-21)