cargo doc
and cargo test --doc
execute rustdoc
in different directories.
#8097
Labels
cargo doc
and cargo test --doc
execute rustdoc
in different directories.
#8097
Problem
It appears that when using workspaces and executing
cargo
against a manifest with only workspace members (i.e., at the root of a repository),cargo doc
andcargo test --doc
executerustdoc
in different directories. This interacts poorly with relative paths used in additional flags forrustdoc
(either from environment variables or a Cargo configuration file).Depending on the relative paths involved (e.g.,
./path
vs.../path
), this causes one ofcargo doc
orcargo test --doc
to fail with an error stating that the path cannot be found.This is likely complicated, but at first I expected that relative paths would resolve the same way for both
cargo doc
andcargo test --doc
when executed in the same directory.Steps
rustdoc
via--html-in-header
using an environment variable or Cargo configuration file.cargo doc
andcargo test --doc
from the root of the repository (using the workspace manifest).See this commit in a workspace repository for an example of this problem. The CI for that project fails with similar errors on different operating systems.
Possible Solution(s)
I'm really not sure what is acceptable here. I encountered this when I tried to migrate away from using a simple shell script for generating documentation that uses the
RUSTDOCFLAGS
environment variable.Notes
I've encountered this using both stable and nightly toolchains on Windows 10 and Arch Linux.
Output of
cargo version
:cargo 1.42.0 (86334295e 2020-01-31)
Output of
cargo +nightly version
:cargo 1.44.0-nightly (7019b3ed3 2020-03-17)
The text was updated successfully, but these errors were encountered: