Skip to content

Commit 5335120

Browse files
committed
Auto merge of #10132 - ehuss:doctest-xcompile-note, r=alexcrichton
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?
2 parents 8032ac5 + ca3356a commit 5335120

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/cargo/ops/cargo_test.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ fn run_doc_tests(
173173
CompileKind::Target(target) => {
174174
if target.short_name() != compilation.host {
175175
// Skip doctests, -Zdoctest-xcompile not enabled.
176+
config.shell().verbose(|shell| {
177+
shell.note(format!(
178+
"skipping doctests for {} ({}), \
179+
cross-compilation doctests are not yet supported\n\
180+
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
181+
for more information.",
182+
unit.pkg,
183+
unit.target.description_named()
184+
))
185+
})?;
176186
continue;
177187
}
178188
}

tests/testsuite/cross_compile.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,10 @@ fn no_cross_doctests() {
617617
[COMPILING] foo v0.0.1 ([CWD])
618618
[RUNNING] `rustc --crate-name foo [..]
619619
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
620+
[NOTE] skipping doctests for foo v0.0.1 ([ROOT]/foo) (lib), \
621+
cross-compilation doctests are not yet supported
622+
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
623+
for more information.
620624
",
621625
)
622626
.run();
@@ -634,6 +638,10 @@ fn no_cross_doctests() {
634638
[RUNNING] `rustc --crate-name foo [..]--test[..]
635639
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
636640
[RUNNING] `[CWD]/target/{triple}/debug/deps/foo-[..][EXE]`
641+
[NOTE] skipping doctests for foo v0.0.1 ([ROOT]/foo) (lib), \
642+
cross-compilation doctests are not yet supported
643+
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#doctest-xcompile \
644+
for more information.
637645
",
638646
triple = target
639647
))

0 commit comments

Comments
 (0)