Update doctest xcompile flags (#15455)

This updates the flags used for doctest xcompile to match the upstream
changes in https://github.com/rust-lang/rust/pull/137096 which renamed
and stabilized the flags.

This cannot be merged until after nightly is published tonight.
This commit is contained in:
Weihang Lo 2025-04-26 13:35:28 +00:00 committed by GitHub
commit ee85adae45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 12 deletions

View File

@ -238,12 +238,10 @@ fn run_doc_tests(
}
if doctest_xcompile {
p.arg("-Zunstable-options");
p.arg("--enable-per-target-ignores");
if let Some((runtool, runtool_args)) = compilation.target_runner(unit.kind) {
p.arg("--runtool").arg(runtool);
p.arg("--test-runtool").arg(runtool);
for arg in runtool_args {
p.arg("--runtool-arg").arg(arg);
p.arg("--test-runtool-arg").arg(arg);
}
}
if let Some(linker) = linker {

View File

@ -285,8 +285,7 @@ This flag changes `cargo test`'s behavior when handling doctests when
a target is passed. Currently, if a target is passed that is different
from the host cargo will simply skip testing doctests. If this flag is
present, cargo will continue as normal, passing the tests to doctest,
while also passing it a `--target` option, as well as enabling
`-Zunstable-features --enable-per-target-ignores` and passing along
while also passing it a `--target` option, as well as passing along
information from `.cargo/config.toml`. See the rustc issue for more information.
```sh

View File

@ -4738,8 +4738,7 @@ fn test_dep_with_dev() {
#[cargo_test(nightly, reason = "-Zdoctest-xcompile is unstable")]
fn cargo_test_doctest_xcompile_ignores() {
// -Zdoctest-xcompile also enables --enable-per-target-ignores which
// allows the ignore-TARGET syntax.
// Test for `ignore-...` syntax with -Zdoctest-xcompile.
let p = project()
.file("Cargo.toml", &basic_lib_manifest("foo"))
.file(
@ -4766,15 +4765,15 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini
.run();
#[cfg(target_arch = "x86_64")]
p.cargo("test")
.with_status(101)
.with_stdout_data(str![[r#"
...
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
...
"#]],
)
"#]])
.run();
// Should be the same with or without -Zdoctest-xcompile because `ignore-`
// syntax is always enabled.
#[cfg(not(target_arch = "x86_64"))]
p.cargo("test -Zdoctest-xcompile")
.masquerade_as_nightly_cargo(&["doctest-xcompile"])