diff --git a/src/cargo/ops/cargo_test.rs b/src/cargo/ops/cargo_test.rs index c3e4eec860f..873aae47dfc 100644 --- a/src/cargo/ops/cargo_test.rs +++ b/src/cargo/ops/cargo_test.rs @@ -178,6 +178,7 @@ fn run_doc_tests( let mut errors = Vec::new(); let doctest_xcompile = gctx.cli_unstable().doctest_xcompile; let color = gctx.shell().color_choice(); + let mut warned_once = false; for doctest_info in &compilation.to_doc_test { let Doctest { @@ -194,6 +195,13 @@ fn run_doc_tests( CompileKind::Host => {} CompileKind::Target(target) => { if target.short_name() != compilation.host { + if !warned_once { + gctx.shell().concise(|shell| { + shell.warn("skipping cross-compilation doctest(s), use --verbose to see the full list in detail.".to_string()) + })?; + warned_once = true; + } + // Skip doctests, -Zdoctest-xcompile not enabled. gctx.shell().verbose(|shell| { shell.note(format!( diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 185c480abb5..53e7e2e033f 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -469,6 +469,7 @@ fn cross_tests() { [FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] unittests src/lib.rs (target/[ALT_TARGET]/debug/deps/foo-[HASH][EXE]) [RUNNING] unittests src/bin/bar.rs (target/[ALT_TARGET]/debug/deps/bar-[HASH][EXE]) +[WARNING] skipping cross-compilation doctest(s), use --verbose to see the full list in detail. "#]]) .with_stdout_data(str![[r#"