cargo::util

Function path_args

Source
pub fn path_args(ws: &Workspace<'_>, unit: &Unit) -> (PathBuf, PathBuf)
Expand description

The path that we pass to rustc is actually fairly important because it will show up in error messages (important for readability), debug information (important for caching), etc. As a result we need to be pretty careful how we actually invoke rustc.

In general users don’t expect cargo build to cause rebuilds if you change directories. That could be if you just change directories in the package or if you literally move the whole package wholesale to a new directory. As a result we mostly don’t factor in cwd to this calculation. Instead we try to track the workspace as much as possible and we update the current directory of rustc/rustdoc where appropriate.

The first returned value here is the argument to pass to rustc, and the second is the cwd that rustc should operate in.