-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking Issue for Cross Compiling Doctests #64245
Comments
@Goirad I don't quite understand - what is this tracking? It sounds like all the functionality is already implemented in rustdoc, what's left to do? |
@jyn514 The rustdoc flags are still unstable, so this is tracking the stabilization of those flags. |
My host is x86_64-unknown-linux-gnu. I'm building for x86_64-unknown-linux-musl. Resulting binaries can be run on this host without any problems. But Moreover, if I don't add |
@safinaskar Can you provide some more information? The tests appear to be run for me with cross compiling to
As for warnings, there is a warning displayed when the verbose flag:
The reason it is only displayed with We definitely recognize that can cause people to not know that tests are not being run. Hopefully most of the time that is evident by the absence of any doc-test display. I would like to see this feature move towards stabilization to help prevent that oversight, so any experience reports would be helpful if you get it to work. |
I am unable to reproduce. I. e. now everything works. It seems there was no problem in the first place, sorry |
This partially addresses cross-rs#225. This only works on nightly, due to the use of the unstable feature [doctest-xcompile](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) The relevant tracking issues are: - rust-lang/cargo#7040 - rust-lang/rust#64245 If the subcommand is `test` and the compiler is nightly, we provide the `-Zdoctest-xcompile` flag if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`.
This partially addresses cross-rs#225. This only works on nightly, due to the use of the unstable feature [doctest-xcompile](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) The relevant tracking issues are: - rust-lang/cargo#7040 - rust-lang/rust#64245 If the subcommand is `test` and the compiler is nightly, we provide the `-Zdoctest-xcompile` flag if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`.
This partially addresses cross-rs#225. This only works on nightly, due to the use of the unstable feature [doctest-xcompile](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) The relevant tracking issues are: - rust-lang/cargo#7040 - rust-lang/rust#64245 If the subcommand is `test` and the compiler is nightly, we provide the `-Zdoctest-xcompile` flag if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`.
This partially addresses cross-rs#225. This only works on nightly, due to the use of the unstable feature [doctest-xcompile](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) The relevant tracking issues are: - rust-lang/cargo#7040 - rust-lang/rust#64245 If the subcommand is `test` and the compiler is nightly, we provide the `-Zdoctest-xcompile` flag if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`.
721: Add preliminary support for running doctests. r=Emilgardis a=Alexhuszagh This partially addresses #225. This only works on nightly, due to the use of the unstable feature [doctest-xcompile](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile) The relevant tracking issues are: - rust-lang/cargo#7040 - rust-lang/rust#64245 If the subcommand is `test` and the compiler is nightly, we provide the `-Zdoctest-xcompile` flag if `CROSS_UNSTABLE_ENABLE_DOCTESTS=true`. Co-authored-by: Alex Huszagh <[email protected]>
By default, cargo test does not run doctests when the target triple does not match the host triple. There are some valid reasons for that to be the case, but we didn't notice until now because no warnings were outputted: the doctests were just silently skipped. Let's use unstable Rust features to run those tests as originally intended. Related tracking issue: rust-lang/rust#64245
For what it's worth, we've been using this unstable feature at Fastly for most of this year (2024), compiling a moderate number of code examples during every CI run for one of our documentation repositories (the target is |
Just an update, I had a small discussion about this at https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile. It sounds like there are a few minor things to decide:
The big question is if we are OK with potentially breaking projects that are doing |
This is an issue to track the functionality added by PR#60387, and also by extension this PR in cargo.
PR#60387 adds three options to rustdoc:
--enable-per-target-ignores
which adds a compiletest-like mechanism for ignoring platform on a substring basis (egignore-foo
)--runtool
and--runtool-arg
for specifying an external program and its arguments, to which the compiled doctest binary will be passed as the final argumentThe companion PR adds a flag to cargo for enabling this feature as well as cross-compiling doctests and parsing runtool tokens from a
.cargo/config
.Eventually another PR for
x.py
can either enable this unconditionally or add a flag for testing the extensive documentation in the standard library on other platforms.This solves cargo issue #6460
The text was updated successfully, but these errors were encountered: