Skip to content

Tracking Issue for -Z doctest-in-workspace #9427

Closed
@ehuss

Description

@ehuss

Summary

Original issue: #8097 #8993
Implementation: #9105
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-in-workspace

The -Z doctest-in-workspace flag changes the behavior of the current working directory used when running doctests. Historically, Cargo has run rustdoc --test relative to the root of the package, with paths relative from that root. However, this is inconsistent with how rustc and rustdoc are normally run in a workspace, where they are run relative to the workspace root. This inconsistency causes problems in various ways, such as when passing RUSTDOCFLAGS with relative paths, or dealing with diagnostic output.

The -Z doctest-in-workspace flag causes cargo to switch to running rustdoc from the root of the workspace. It also passes the --test-run-directory to rustdoc so that when running the tests, they are run from the root of the package. This preserves backwards compatibility and is consistent with how normal unittests are run.

Unresolved issues

None at this time.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

cc @Swatinem

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: rustdoc --testC-tracking-issueCategory: A tracking issue for something unstable.S-waiting-on-feedbackStatus: An implemented feature is waiting on community feedback for bugs or design concerns.T-cargoTeam: Cargodisposition-mergeFCP with intent to mergefinished-final-comment-periodFCP complete

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions