Skip to content

Cargo does not pass --target to rustdoc --test for the host target #10560

@jyn514

Description

@jyn514

Problem

cargo test --doc --target x86_64-unknown-linux-gnu does not pass a --target flag to rustdoc if the host target is x86_64-unknown-linux-gnu. This is inconsistent with cargo doc/check/build. It caused trouble for bootstrap in rust-lang/rust#95993.

Steps

  1. cargo new --lib example
  2. cd example
  3. cargo test --doc --target x86_64-unknown-linux-gnu -v

Observe that no --target argument is passed to rustdoc.

Possible Solution(s)

Pass --target to rustdoc.

Notes

No response

Version

cargo 1.61.0-nightly (109bfbd 2022-03-17)
release: 1.61.0-nightly
commit-hash: 109bfbd055325ef87a6e7f63d67da7e838f8300b
commit-date: 2022-03-17
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1m)
os: Pop!_OS 20.04 (focal) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions