Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jyn514 opened this issue Apr 13, 2022 · 4 comments · Fixed by #10594
Closed

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

jyn514 opened this issue Apr 13, 2022 · 4 comments · Fixed by #10594
Labels
A-doctests Area: rustdoc --test C-bug Category: bug Command-test

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 13, 2022

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]
@jyn514 jyn514 added the C-bug Category: bug label Apr 13, 2022
@weihanglo
Copy link
Member

Hmm… I believe the feature -Zdoctest-xcompile is still unstable. As far as I know, it waits for rustdoc --enable-per-target-ignores and --runtool|--runtool-arg to be stabilized.

Closing in favor of the tracking issues rust-lang/rust#64245 and #7040. Thanks!

@jyn514
Copy link
Member Author

jyn514 commented Apr 23, 2022

@weihanglo no, this does not depend on -Zdoctest-xcompile, it works on stable.

@weihanglo
Copy link
Member

weihanglo commented Apr 23, 2022

Sorry. Did you mean Cargo should pass --target to rustdoc if the --target is the host target?

@jyn514
Copy link
Member Author

jyn514 commented Apr 23, 2022

Yes, exactly. That matches the behavior of cargo build and cargo doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: rustdoc --test C-bug Category: bug Command-test
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants