-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
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)