From c4312a4aa032a6a8f6cea0a06d8d533399d6c8f3 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 17 Jun 2023 21:44:58 +0100 Subject: [PATCH 1/3] docs(cargo-test): missing apostrophe for possessive nouns --- src/doc/man/cargo-test.md | 2 +- src/doc/man/generated_txt/cargo-test.txt | 2 +- src/doc/src/commands/cargo-test.md | 2 +- src/etc/man/cargo-test.1 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/man/cargo-test.md b/src/doc/man/cargo-test.md index 22d231d0e27..4c3a9fb4518 100644 --- a/src/doc/man/cargo-test.md +++ b/src/doc/man/cargo-test.md @@ -69,7 +69,7 @@ For documentation tests, the working directory when invoking `rustdoc` is set to the workspace root directory, and is also the directory `rustdoc` uses as the compilation directory of each documentation test. The working directory when running each documentation test is set to the root -directory of the package the test belongs to, and is controlled via `rustdoc`s +directory of the package the test belongs to, and is controlled via `rustdoc`'s `--test-run-directory` option. ## OPTIONS diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt index ff04aed9422..7cb952397e2 100644 --- a/src/doc/man/generated_txt/cargo-test.txt +++ b/src/doc/man/generated_txt/cargo-test.txt @@ -64,7 +64,7 @@ DESCRIPTION uses as the compilation directory of each documentation test. The working directory when running each documentation test is set to the root directory of the package the test belongs to, and is controlled via - rustdocs --test-run-directory option. + rustdoc’s --test-run-directory option. OPTIONS Test Options diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 18cddcb787e..17296ded565 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -69,7 +69,7 @@ For documentation tests, the working directory when invoking `rustdoc` is set to the workspace root directory, and is also the directory `rustdoc` uses as the compilation directory of each documentation test. The working directory when running each documentation test is set to the root -directory of the package the test belongs to, and is controlled via `rustdoc`s +directory of the package the test belongs to, and is controlled via `rustdoc`'s `--test-run-directory` option. ## OPTIONS diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index fe9bf504dc7..59e7c047f7d 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -64,7 +64,7 @@ For documentation tests, the working directory when invoking \fBrustdoc\fR is se the workspace root directory, and is also the directory \fBrustdoc\fR uses as the compilation directory of each documentation test. The working directory when running each documentation test is set to the root -directory of the package the test belongs to, and is controlled via \fBrustdoc\fRs +directory of the package the test belongs to, and is controlled via \fBrustdoc\fR\[cq]s \fB\-\-test\-run\-directory\fR option. .SH "OPTIONS" .SS "Test Options" From b630ac16a91b2da3f5ae78e16804d75181338940 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 17 Jun 2023 21:45:53 +0100 Subject: [PATCH 2/3] docs(cargo-test): clarify the cwd is for running tests --- src/doc/man/cargo-test.md | 6 +++--- src/doc/man/generated_txt/cargo-test.txt | 10 +++++----- src/doc/src/commands/cargo-test.md | 6 +++--- src/etc/man/cargo-test.1 | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/doc/man/cargo-test.md b/src/doc/man/cargo-test.md index 4c3a9fb4518..75bf72b3070 100644 --- a/src/doc/man/cargo-test.md +++ b/src/doc/man/cargo-test.md @@ -59,9 +59,9 @@ on writing doc tests. ### Working directory of tests -The working directory of every test is set to the root directory of the package -the test belongs to. -Setting the working directory of tests to the package's root directory makes it +The working directory when running each unit and integration test is set to the +root directory of the package the test belongs to. +Setting the working directory of tests to the package's root directory makes it possible for tests to reliably access the package's files using relative paths, regardless from where `cargo test` was executed from. diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt index 7cb952397e2..7955b0e3dd9 100644 --- a/src/doc/man/generated_txt/cargo-test.txt +++ b/src/doc/man/generated_txt/cargo-test.txt @@ -53,11 +53,11 @@ DESCRIPTION information on writing doc tests. Working directory of tests - The working directory of every test is set to the root directory of the - package the test belongs to. Setting the working directory of tests to - the package’s root directory makes it possible for tests to reliably - access the package’s files using relative paths, regardless from where - cargo test was executed from. + The working directory when running each unit and integration test is set + to the root directory of the package the test belongs to. Setting the + working directory of tests to the package’s root directory makes it + possible for tests to reliably access the package’s files using + relative paths, regardless from where cargo test was executed from. For documentation tests, the working directory when invoking rustdoc is set to the workspace root directory, and is also the directory rustdoc diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 17296ded565..e38e9929e22 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -59,9 +59,9 @@ on writing doc tests. ### Working directory of tests -The working directory of every test is set to the root directory of the package -the test belongs to. -Setting the working directory of tests to the package's root directory makes it +The working directory when running each unit and integration test is set to the +root directory of the package the test belongs to. +Setting the working directory of tests to the package's root directory makes it possible for tests to reliably access the package's files using relative paths, regardless from where `cargo test` was executed from. diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index 59e7c047f7d..802169815b6 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -54,9 +54,9 @@ and may change in the future; beware of depending on it. See the \fIrustdoc book\fR for more information on writing doc tests. .SS "Working directory of tests" -The working directory of every test is set to the root directory of the package -the test belongs to. -Setting the working directory of tests to the package\[cq]s root directory makes it +The working directory when running each unit and integration test is set to the +root directory of the package the test belongs to. +Setting the working directory of tests to the package\[cq]s root directory makes it possible for tests to reliably access the package\[cq]s files using relative paths, regardless from where \fBcargo test\fR was executed from. .sp From 132057306d51cb0d12d9a8af39b3522b30844d19 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 17 Jun 2023 21:48:46 +0100 Subject: [PATCH 3/3] docs(unstable): remove tracking for `-Zdoctest-in-workspace` --- src/doc/src/reference/unstable.md | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 49d3e007ef4..afb2f7cbd61 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -1185,24 +1185,6 @@ cargo +nightly -Zunstable-options config get build.rustflags If no config value is included, it will display all config values. See the `--help` output for more options available. -### `doctest-in-workspace` - -* Tracking Issue: [#9427](https://github.com/rust-lang/cargo/issues/9427) - -The `-Z doctest-in-workspace` flag changes the behavior of the current working -directory used when running doctests. Historically, Cargo has run `rustdoc ---test` relative to the root of the package, with paths relative from that -root. However, this is inconsistent with how `rustc` and `rustdoc` are -normally run in a workspace, where they are run relative to the workspace -root. This inconsistency causes problems in various ways, such as when passing -RUSTDOCFLAGS with relative paths, or dealing with diagnostic output. - -The `-Z doctest-in-workspace` flag causes cargo to switch to running `rustdoc` -from the root of the workspace. It also passes the `--test-run-directory` to -`rustdoc` so that when *running* the tests, they are run from the root of the -package. This preserves backwards compatibility and is consistent with how -normal unittests are run. - ### rustc `--print` * Tracking Issue: [#9357](https://github.com/rust-lang/cargo/issues/9357) @@ -1799,4 +1781,4 @@ The [`cargo logout`] command has been stabilized in the 1.70 release. The `-Z doctest-in-workspace` option for `cargo test` has been stabilized and enabled by default in the 1.72 release. See the [`cargo test` documentation](../commands/cargo-test.md#working-directory-of-tests) -for more information about the working directory for compiling and running tests. \ No newline at end of file +for more information about the working directory for compiling and running tests.