-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 test --workspace
ignores target for doctests only in workspaces
#10906
Comments
Thanks for the report! Can you provide an example layout of projects that exhibits the problem? Either as text here, or as a temporary GitHub repo would be helpful. For example, the following works for me: # Root Cargo.toml
[workspace]
members = ["bar"]
[package]
name = "foo"
version = "1.0.0" And have It is a known issue that doctests aren't run with |
I have crated a minimal example project here: https://github.com/bkolobara/reproduce_cargo_issue While crating it, I realised the issue only came up for [lib]
proc-macro = true in their When running
The doctest doesn't run for the
I assume it's related to proc-macros always being compiled to the default target. |
Ah, thanks for putting that together! Yea, a proc-macro is always forced to be tested on the host target regardless of what was requested because proc-macros usually cannot be tested on the target (because they need to link into the compiler). I understand that isn't particularly obvious, but I don't think that is behavior we can change. |
I'm going to close as this is mostly working as intended. There is issue #7040 tracking better support for doctest cross-testing. Additionally rust-lang/rust#50784 is open for running doctests in binaries (which is the case in the reproduction). |
Problem
The behaviour around doctests in the top crate and workspaces is inconsistent when using a custom target.
Steps
If I use a custom target inside of
.cargo/config.toml
, e.g.:And run
cargo test --workspace
. All regular tests in the top crate and tests in the workspaces are correctly compiled to the target and run with the specified runner.This is not true for doctests. In the top crate they are skipped (I assume because
wasm32-wasi
is not supported for doctests). But in workspace crates they are compiled to the default target and fail.Possible Solution(s)
I would expect them to behave the same in sub-crates and just be skipped.
Notes
No response
Version
The text was updated successfully, but these errors were encountered: