From c262603f523f469bc9c0857cd4652a3eec9aabe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Tue, 15 Apr 2025 15:22:01 +0200 Subject: [PATCH] Deprecate option `--test-args` in favor of new insta-stable option `--test-arg` --- src/doc/rustdoc/src/command-line-arguments.md | 10 +++++++--- src/librustdoc/config.rs | 14 +++++++++++--- src/librustdoc/lib.rs | 17 ++++++++++++++++- tests/run-make/doctests-merge/rmake.rs | 2 +- .../output-default.stdout | 7 +++++-- tests/rustdoc-ui/2024-doctests-checks.rs | 2 +- .../rustdoc-ui/2024-doctests-crate-attribute.rs | 2 +- tests/rustdoc-ui/doctest/cfg-test.rs | 2 +- .../doctest/comment-in-attr-134221-2.rs | 2 +- .../doctest/comment-in-attr-134221.rs | 2 +- tests/rustdoc-ui/doctest/display-output.rs | 2 +- .../doctest-multiline-crate-attribute.rs | 2 +- .../doctest/doctest-output-include-fail.rs | 2 +- .../doctest/doctest-output.edition2015.stdout | 6 +++--- .../doctest/doctest-output.edition2024.stdout | 6 +++--- tests/rustdoc-ui/doctest/doctest-output.rs | 10 ++++------ tests/rustdoc-ui/doctest/extern-crate.rs | 2 +- .../doctest/failed-doctest-output-windows.rs | 2 +- .../rustdoc-ui/doctest/failed-doctest-output.rs | 2 +- .../rustdoc-ui/doctest/merged-ignore-no_run.rs | 2 +- tests/rustdoc-ui/doctest/nested-main.rs | 2 +- tests/rustdoc-ui/doctest/no-run-flag-error.rs | 2 +- tests/rustdoc-ui/doctest/no-run-flag.rs | 2 +- tests/rustdoc-ui/doctest/non-local-defs-impl.rs | 2 +- tests/rustdoc-ui/doctest/non_local_defs.rs | 2 +- ...path-include-bytes-132203.edition2015.stdout | 8 ++++---- .../relative-path-include-bytes-132203.rs | 3 +-- tests/rustdoc-ui/doctest/test-type.rs | 2 +- tests/rustdoc-ui/doctest/wrong-ast-2024.rs | 2 +- tests/rustdoc-ui/doctest/wrong-ast.rs | 2 +- tests/rustdoc-ui/issues/issue-91134.rs | 2 +- tests/rustdoc-ui/opt-test-args-is-deprecated.rs | 7 +++++++ .../remap-path-prefix-failed-doctest-output.rs | 2 +- .../remap-path-prefix-invalid-doctest.rs | 2 +- .../remap-path-prefix-passed-doctest-output.rs | 2 +- 35 files changed, 86 insertions(+), 52 deletions(-) create mode 100644 tests/rustdoc-ui/opt-test-args-is-deprecated.rs diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index 872592d669d6d..8488c850260fa 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -194,14 +194,14 @@ $ rustdoc src/lib.rs --test This flag will run your code examples as tests. For more, see [the chapter on documentation tests](write-documentation/documentation-tests.md). -See also `--test-args` and `--test-run-directory`. +See also `--test-arg` and `--test-run-directory`. -## `--test-args`: pass options to test runner +## `--test-arg`: pass an option to the test runner Using this flag looks like this: ```bash -$ rustdoc src/lib.rs --test --test-args ignored +$ rustdoc src/lib.rs --test --test-arg ignored --test-arg --show-output ``` This flag will pass options to the test runner when running documentation tests. @@ -431,6 +431,10 @@ command line options from it. These options are one per line; a blank line indic an empty option. The file can use Unix or Windows style line endings, and must be encoded as UTF-8. +## `--test-args`: pass options to the test runner + +This flag is **deprecated**, use `--test-arg` instead. + ## `--passes`: add more rustdoc passes This flag is **deprecated**. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 23a2bcd9011ee..edffcdfa667ae 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -618,9 +618,17 @@ impl Options { ) .collect(); - let test_args = matches.opt_strs("test-args"); - let test_args: Vec = - test_args.iter().flat_map(|s| s.split_whitespace()).map(|s| s.to_string()).collect(); + let mut test_args = matches.opt_strs("test-arg"); + + // FIXME: Emit a (hard) deprecation warning in a few releases from the time of writing + // once at least Cargo has had a good chance to migrate to the new flag. + test_args.extend( + matches + .opt_strs("test-args") + .iter() + .flat_map(|s| s.split_whitespace()) + .map(|s| s.to_string()), + ); let should_test = matches.opt_present("test"); let no_run = matches.opt_present("no-run"); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 4fe5e13c3afe0..82816af06489a 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -267,7 +267,14 @@ fn opts() -> Vec { "", ), opt(Stable, FlagMulti, "", "test", "run code examples as tests", ""), - opt(Stable, Multi, "", "test-args", "arguments to pass to the test runner", "ARGS"), + opt( + Stable, + Multi, + "", + "test-arg", + "One argument (of possibly many) to pass to the test runner", + "ARG", + ), opt( Stable, Opt, @@ -659,6 +666,14 @@ fn opts() -> Vec { "", ), // deprecated / removed options + opt( + Stable, + Multi, + "", + "test-args", + "Arguments to pass to the test runner. This option is deprecated, use `--test-arg` instead", + "ARGS", + ), opt( Stable, Multi, diff --git a/tests/run-make/doctests-merge/rmake.rs b/tests/run-make/doctests-merge/rmake.rs index a88b050c50fa8..2f1eb3431bd1d 100644 --- a/tests/run-make/doctests-merge/rmake.rs +++ b/tests/run-make/doctests-merge/rmake.rs @@ -9,7 +9,7 @@ fn test_and_compare(input_file: &str, stdout_file: &str, edition: &str, dep: &Pa .input(input_file) .arg("--test") .edition(edition) - .arg("--test-args=--test-threads=1") + .arg("--test-arg=--test-threads=1") .extern_("foo", dep.display().to_string()) .env("RUST_BACKTRACE", "short") .run(); diff --git a/tests/run-make/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout index 01f470f6e162b..352a8615d4d99 100644 --- a/tests/run-make/rustdoc-default-output/output-default.stdout +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -34,8 +34,8 @@ Options: --document-hidden-items document items that have doc(hidden) --test run code examples as tests - --test-args ARGS - arguments to pass to the test runner + --test-arg ARG One argument (of possibly many) to pass to the test + runner --test-run-directory PATH The working directory in which to run tests --target TRIPLE target triple to document @@ -196,6 +196,9 @@ Options: --disable-minification disable the minification of CSS/JS files (perma-unstable, do not use with cached files) + --test-args ARGS + Arguments to pass to the test runner. This option is + deprecated, use `--test-arg` instead --plugin-path DIR removed, see issue #44136 for diff --git a/tests/rustdoc-ui/2024-doctests-checks.rs b/tests/rustdoc-ui/2024-doctests-checks.rs index 0c3a11771f34e..6a572161f5943 100644 --- a/tests/rustdoc-ui/2024-doctests-checks.rs +++ b/tests/rustdoc-ui/2024-doctests-checks.rs @@ -1,6 +1,6 @@ //@ check-pass //@ edition: 2024 -//@ compile-flags: --test --test-args=--test-threads=1 +//@ compile-flags: --test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs index c9887cbc63bae..99a89ca21a5ae 100644 --- a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs +++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs @@ -1,6 +1,6 @@ //@ check-pass //@ edition: 2024 -//@ compile-flags: --test --test-args=--test-threads=1 +//@ compile-flags: --test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" diff --git a/tests/rustdoc-ui/doctest/cfg-test.rs b/tests/rustdoc-ui/doctest/cfg-test.rs index 340a2eec87a81..235df8e4d74eb 100644 --- a/tests/rustdoc-ui/doctest/cfg-test.rs +++ b/tests/rustdoc-ui/doctest/cfg-test.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:--test --test-args --test-threads=1 +//@ compile-flags:--test --test-arg --test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs index 944939c8efe81..e9acd371f9231 100644 --- a/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs @@ -1,4 +1,4 @@ -//@ compile-flags:--test --test-args --test-threads=1 +//@ compile-flags:--test --test-arg --test-threads=1 //@ failure-status: 101 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs index 2fbc8a2156079..b4776becc2c05 100644 --- a/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs @@ -2,7 +2,7 @@ // It checks that even if there are comments in the attributes, the attributes // will still be generated correctly (and therefore fail in this test). -//@ compile-flags:--test --test-args --test-threads=1 +//@ compile-flags:--test --test-arg --test-threads=1 //@ failure-status: 101 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/display-output.rs b/tests/rustdoc-ui/doctest/display-output.rs index d5de341b69629..818d715c0bf36 100644 --- a/tests/rustdoc-ui/doctest/display-output.rs +++ b/tests/rustdoc-ui/doctest/display-output.rs @@ -2,7 +2,7 @@ //@ check-pass //@ edition:2018 -//@ compile-flags:--test --test-args=--show-output +//@ compile-flags:--test --test-arg=--show-output //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs index 1f80e002ef5d2..c8110b7276733 100644 --- a/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs +++ b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs @@ -1,4 +1,4 @@ -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ check-pass diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs index a47bac3daefed..7121a432c91d7 100644 --- a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs +++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs @@ -1,5 +1,5 @@ //@ edition:2024 -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ failure-status: 101 diff --git a/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout b/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout index 0e2e30390ad93..e573048abcfc0 100644 --- a/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout @@ -1,8 +1,8 @@ running 3 tests -test $DIR/doctest-output.rs - (line 12) ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok -test $DIR/doctest-output.rs - foo::bar (line 22) ... ok +test $DIR/doctest-output.rs - (line 10) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 26) ... ok +test $DIR/doctest-output.rs - foo::bar (line 20) ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout b/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout index 0e2e30390ad93..e573048abcfc0 100644 --- a/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout +++ b/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout @@ -1,8 +1,8 @@ running 3 tests -test $DIR/doctest-output.rs - (line 12) ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok -test $DIR/doctest-output.rs - foo::bar (line 22) ... ok +test $DIR/doctest-output.rs - (line 10) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 26) ... ok +test $DIR/doctest-output.rs - foo::bar (line 20) ... ok test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/doctest/doctest-output.rs b/tests/rustdoc-ui/doctest/doctest-output.rs index 04bd1813b4c81..8aec2724359bb 100644 --- a/tests/rustdoc-ui/doctest/doctest-output.rs +++ b/tests/rustdoc-ui/doctest/doctest-output.rs @@ -1,10 +1,8 @@ //@ revisions: edition2015 edition2024 -//@[edition2015]edition:2015 -//@[edition2015]aux-build:extern_macros.rs -//@[edition2015]compile-flags:--test --test-args=--test-threads=1 -//@[edition2024]edition:2024 -//@[edition2024]aux-build:extern_macros.rs -//@[edition2024]compile-flags:--test --test-args=--test-threads=1 +//@[edition2015] edition: 2015 +//@[edition2024] edition: 2024 +//@ aux-build:extern_macros.rs +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ check-pass diff --git a/tests/rustdoc-ui/doctest/extern-crate.rs b/tests/rustdoc-ui/doctest/extern-crate.rs index 0415d33bb723b..289e934b1779f 100644 --- a/tests/rustdoc-ui/doctest/extern-crate.rs +++ b/tests/rustdoc-ui/doctest/extern-crate.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs index 3a08faf626f12..84a0aab3febd4 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs @@ -5,7 +5,7 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test --test-args --test-threads=1 +//@ compile-flags:--test --test-arg --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.rs b/tests/rustdoc-ui/doctest/failed-doctest-output.rs index 84c7226888123..483391880d0a5 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.rs @@ -5,7 +5,7 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test --test-args --test-threads=1 +//@ compile-flags:--test --test-arg --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs b/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs index 7dac64e6de420..d0afd2da97ffa 100644 --- a/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs +++ b/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs @@ -1,5 +1,5 @@ //@ edition: 2024 -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ check-pass diff --git a/tests/rustdoc-ui/doctest/nested-main.rs b/tests/rustdoc-ui/doctest/nested-main.rs index d1b3bd6da40c0..853e8cbb23a63 100644 --- a/tests/rustdoc-ui/doctest/nested-main.rs +++ b/tests/rustdoc-ui/doctest/nested-main.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/no-run-flag-error.rs b/tests/rustdoc-ui/doctest/no-run-flag-error.rs index 3f9016b23db41..5d9f00505d0d8 100644 --- a/tests/rustdoc-ui/doctest/no-run-flag-error.rs +++ b/tests/rustdoc-ui/doctest/no-run-flag-error.rs @@ -1,6 +1,6 @@ // test the behavior of the --no-run flag without the --test flag -//@ compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1 +//@ compile-flags:-Z unstable-options --no-run --test-arg=--test-threads=1 pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/no-run-flag.rs b/tests/rustdoc-ui/doctest/no-run-flag.rs index 8f1381e076048..4cef987ccdefe 100644 --- a/tests/rustdoc-ui/doctest/no-run-flag.rs +++ b/tests/rustdoc-ui/doctest/no-run-flag.rs @@ -1,7 +1,7 @@ // test the behavior of the --no-run flag //@ check-pass -//@ compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 +//@ compile-flags:-Z unstable-options --test --no-run --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/non-local-defs-impl.rs b/tests/rustdoc-ui/doctest/non-local-defs-impl.rs index f2540574f15ae..f06789079adb9 100644 --- a/tests/rustdoc-ui/doctest/non-local-defs-impl.rs +++ b/tests/rustdoc-ui/doctest/non-local-defs-impl.rs @@ -2,7 +2,7 @@ //@ edition:2018 //@ failure-status: 101 //@ aux-build:pub_trait.rs -//@ compile-flags: --test --test-args --test-threads=1 +//@ compile-flags: --test --test-arg --test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/non_local_defs.rs b/tests/rustdoc-ui/doctest/non_local_defs.rs index ce65ad2cf72c2..52f647b066011 100644 --- a/tests/rustdoc-ui/doctest/non_local_defs.rs +++ b/tests/rustdoc-ui/doctest/non_local_defs.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:--test --test-args --test-threads=1 --nocapture -Zunstable-options +//@ compile-flags:--test --test-arg --test-threads=1 --test-arg --nocapture -Zunstable-options //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stderr: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout index ff26e7e323186..16635a385548e 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout @@ -1,12 +1,12 @@ running 1 test -test $DIR/relative-path-include-bytes-132203.rs - (line 18) ... FAILED +test $DIR/relative-path-include-bytes-132203.rs - (line 17) ... FAILED failures: ----- $DIR/relative-path-include-bytes-132203.rs - (line 18) stdout ---- +---- $DIR/relative-path-include-bytes-132203.rs - (line 17) stdout ---- error: couldn't read `$DIR/relative-dir-empty-file`: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/relative-path-include-bytes-132203.rs:19:9 + --> $DIR/relative-path-include-bytes-132203.rs:18:9 | LL | let x = include_bytes!("relative-dir-empty-file"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ error: aborting due to 1 previous error Couldn't compile the test. failures: - $DIR/relative-path-include-bytes-132203.rs - (line 18) + $DIR/relative-path-include-bytes-132203.rs - (line 17) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs index ceacd69a5fd52..5e5ad3b1dde53 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs @@ -2,10 +2,9 @@ //@[edition2015]edition:2015 //@[edition2015]check-fail //@[edition2015]failure-status: 101 -//@[edition2015]compile-flags:--test --test-args=--test-threads=1 //@[edition2024]edition:2024 //@[edition2024]check-pass -//@[edition2024]compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests.rustdoc-ui.doctest." -> "$$DIR/" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: "`: .* \(os error 2\)" -> "`: $$FILE_NOT_FOUND_MSG (os error 2)" diff --git a/tests/rustdoc-ui/doctest/test-type.rs b/tests/rustdoc-ui/doctest/test-type.rs index 28c862fb69b62..198d84e0bd685 100644 --- a/tests/rustdoc-ui/doctest/test-type.rs +++ b/tests/rustdoc-ui/doctest/test-type.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --test --test-args=--test-threads=1 +//@ compile-flags: --test --test-arg=--test-threads=1 //@ check-pass //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/doctest/wrong-ast-2024.rs b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs index 3b4fb3f34433e..5fca18ac13090 100644 --- a/tests/rustdoc-ui/doctest/wrong-ast-2024.rs +++ b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs @@ -1,5 +1,5 @@ //@ edition: 2024 -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" diff --git a/tests/rustdoc-ui/doctest/wrong-ast.rs b/tests/rustdoc-ui/doctest/wrong-ast.rs index be8f541758692..e783a8b20fd64 100644 --- a/tests/rustdoc-ui/doctest/wrong-ast.rs +++ b/tests/rustdoc-ui/doctest/wrong-ast.rs @@ -1,4 +1,4 @@ -//@ compile-flags:--test --test-args=--test-threads=1 +//@ compile-flags:--test --test-arg=--test-threads=1 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ failure-status: 101 diff --git a/tests/rustdoc-ui/issues/issue-91134.rs b/tests/rustdoc-ui/issues/issue-91134.rs index 1c53ecfeb8b7a..f1157cd2a7ae5 100644 --- a/tests/rustdoc-ui/issues/issue-91134.rs +++ b/tests/rustdoc-ui/issues/issue-91134.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1 +//@ compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-arg=--test-threads=1 //@ aux-build:empty-fn.rs //@ check-pass //@ normalize-stdout: "tests/rustdoc-ui/issues" -> "$$DIR" diff --git a/tests/rustdoc-ui/opt-test-args-is-deprecated.rs b/tests/rustdoc-ui/opt-test-args-is-deprecated.rs new file mode 100644 index 0000000000000..044759d32ff48 --- /dev/null +++ b/tests/rustdoc-ui/opt-test-args-is-deprecated.rs @@ -0,0 +1,7 @@ +//! Option `--test-args ARGS` has been deprecated in favor of `--test-arg ARG`. +//! Test that it's still accepted. +// FIXME: Use this test to check that using this flag will emit a +// (hard) deprecation warning once it does. + +//@ compile-flags: --test-args argument +//@ check-pass diff --git a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs index 72c3330709a7c..bf69b53350ecf 100644 --- a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs +++ b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away //@ failure-status: 101 -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-arg --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ normalize-stdout: "exit (status|code): 101" -> "exit status: 101" diff --git a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs index c18a416d43f08..1406b537bb927 100644 --- a/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs +++ b/tests/rustdoc-ui/remap-path-prefix-invalid-doctest.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away //@ failure-status: 101 -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-arg --test-threads=1 //@ rustc-env:RUST_BACKTRACE=0 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" diff --git a/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs b/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs index 6fa04ef77f32b..dbb19ec989062 100644 --- a/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs +++ b/tests/rustdoc-ui/remap-path-prefix-passed-doctest-output.rs @@ -4,7 +4,7 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-args --test-threads=1 +//@ compile-flags:--test -Z unstable-options --remap-path-prefix={{src-base}}=remapped_path --test-arg --test-threads=1 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" // doctest passes at runtime