Problem
cargo 1.50.0-nightly changes the current working directory for doctests when executed from a workspace. Instead of the crate's root, the workspace's root is assumed. The regression originates in #8954. I think, the cwd should still point to the crate root in all cases.
Steps
- Crate a workspace with a member crate in a subdirectory.
- Write a doctest that reads a file relative to the crate root, e.g.
src/lib.rs.
- Test with
cargo +stable test --workspace and observe the test pass.
- Test with
cargo +nightly test --workspace and observe the test fail.
Possible Solution(s)
Notes
Output of cargo version: cargo 1.50.0-nightly (d274fcf86 2020-12-07)
Example src/lib.rs for a workspace member that will pass on stable but fail on nightly:
//! ```
//! assert_eq!(std::fs::read_to_string("src/lib.rs").unwrap(), include_str!("lib.rs"));
//! ```
Problem
cargo 1.50.0-nightlychanges the current working directory for doctests when executed from a workspace. Instead of the crate's root, the workspace's root is assumed. The regression originates in #8954. I think, the cwd should still point to the crate root in all cases.Steps
src/lib.rs.cargo +stable test --workspaceand observe the test pass.cargo +nightly test --workspaceand observe the test fail.Possible Solution(s)
-Zinstrument-coveragerust#79417.Notes
Output of
cargo version:cargo 1.50.0-nightly (d274fcf86 2020-12-07)Example
src/lib.rsfor a workspace member that will pass on stable but fail on nightly: