Skip to content

Commit

Permalink
Auto merge of #10132 - ehuss:doctest-xcompile-note, r=alexcrichton
Browse files Browse the repository at this point in the history
Add a note about doctest xcompile.

This adds a note when running with `--verbose` if doctests are being skipped because they do not support cross-compiling.

I decided to use verbose instead of always displaying it because I felt it could get really noisy.  However, I'm a bit on the fence.  I'm kinda curious what is blocking doctest-xcompile from being stabilized?
  • Loading branch information
bors committed Nov 29, 2021
2 parents 8032ac5 + ca3356a commit 5335120
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cargo/ops/cargo_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ fn run_doc_tests(
CompileKind::Target(target) => {
if target.short_name() != compilation.host {
// Skip doctests, -Zdoctest-xcompile not enabled.
config.shell().verbose(|shell| {
shell.note(format!(
"skipping doctests for {} ({}), \
cross-compilation doctests are not yet supported\n\
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
for more information.",
unit.pkg,
unit.target.description_named()
))
})?;
continue;
}
}
Expand Down
8 changes: 8 additions & 0 deletions tests/testsuite/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ fn no_cross_doctests() {
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc --crate-name foo [..]
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[NOTE] skipping doctests for foo v0.0.1 ([ROOT]/foo) (lib), \
cross-compilation doctests are not yet supported
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
for more information.
",
)
.run();
Expand All @@ -634,6 +638,10 @@ fn no_cross_doctests() {
[RUNNING] `rustc --crate-name foo [..]--test[..]
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`
[NOTE] skipping doctests for foo v0.0.1 ([ROOT]/foo) (lib), \
cross-compilation doctests are not yet supported
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
for more information.
",
triple = target
))
Expand Down

0 comments on commit 5335120

Please sign in to comment.