diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs
index 69bae2c5912..53916715a9f 100644
--- a/src/cargo/ops/cargo_run.rs
+++ b/src/cargo/ops/cargo_run.rs
@@ -93,6 +93,11 @@ pub fn run(
};
let pkg = bins[0].0;
let mut process = compile.target_process(exe, unit.kind, pkg, *script_meta)?;
+
+ // Sets the working directory of the child process to the current working
+ // directory of the parent process.
+ // Overrides the default working directory of the `ProcessBuilder` returned
+ // by `compile.target_process` (the package's root directory)
process.args(args).cwd(config.cwd());
config.shell().status("Running", process.to_string())?;
diff --git a/src/doc/man/cargo-bench.md b/src/doc/man/cargo-bench.md
index 32c98dadaeb..80785891b5b 100644
--- a/src/doc/man/cargo-bench.md
+++ b/src/doc/man/cargo-bench.md
@@ -56,6 +56,14 @@ debugger.
[`bench` profile]: ../reference/profiles.html#bench
+### Working directory of benchmarks
+
+The working directory of every benchmark is set to the root directory of the
+package the benchmark belongs to.
+Setting the working directory of benchmarks to the package's root directory
+makes it possible for benchmarks to reliably access the package's files using
+relative paths, regardless from where `cargo bench` was executed from.
+
## OPTIONS
### Benchmark Options
diff --git a/src/doc/man/cargo-run.md b/src/doc/man/cargo-run.md
index 4b6b935242e..034a35f23eb 100644
--- a/src/doc/man/cargo-run.md
+++ b/src/doc/man/cargo-run.md
@@ -17,6 +17,10 @@ All the arguments following the two dashes (`--`) are passed to the binary to
run. If you're passing arguments to both Cargo and the binary, the ones after
`--` go to the binary, the ones before go to Cargo.
+Unlike {{man "cargo-test" 1}} and {{man "cargo-bench" 1}}, `cargo run` sets the
+working directory of the binary executed to the current working directory, same
+as if it was executed in the shell directly.
+
## OPTIONS
{{> section-options-package }}
diff --git a/src/doc/man/cargo-test.md b/src/doc/man/cargo-test.md
index 0b6da16ca5e..3dce146e60d 100644
--- a/src/doc/man/cargo-test.md
+++ b/src/doc/man/cargo-test.md
@@ -57,6 +57,14 @@ and may change in the future; beware of depending on it.
See the [rustdoc book](https://doc.rust-lang.org/rustdoc/) for more 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.
+
## OPTIONS
### Test Options
diff --git a/src/doc/man/generated_txt/cargo-bench.txt b/src/doc/man/generated_txt/cargo-bench.txt
index aaa495d4639..0fbcb8be464 100644
--- a/src/doc/man/generated_txt/cargo-bench.txt
+++ b/src/doc/man/generated_txt/cargo-bench.txt
@@ -49,6 +49,13 @@ DESCRIPTION
switch to the dev profile. You can then run the debug-enabled benchmark
within a debugger.
+ Working directory of benchmarks
+ The working directory of every benchmark is set to the root directory of
+ the package the benchmark belongs to. Setting the working directory of
+ benchmarks to the package’s root directory makes it possible for
+ benchmarks to reliably access the package’s files using relative
+ paths, regardless from where cargo bench was executed from.
+
OPTIONS
Benchmark Options
--no-run
diff --git a/src/doc/man/generated_txt/cargo-run.txt b/src/doc/man/generated_txt/cargo-run.txt
index 4512bb0c97f..2594ff94797 100644
--- a/src/doc/man/generated_txt/cargo-run.txt
+++ b/src/doc/man/generated_txt/cargo-run.txt
@@ -13,6 +13,10 @@ DESCRIPTION
to run. If you’re passing arguments to both Cargo and the binary, the
ones after -- go to the binary, the ones before go to Cargo.
+ Unlike cargo-test(1) and cargo-bench(1), cargo run sets the working
+ directory of the binary executed to the current working directory, same
+ as if it was executed in the shell directly.
+
OPTIONS
Package Selection
By default, the package in the current working directory is selected.
diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt
index bb17deb9d85..4ab1841e120 100644
--- a/src/doc/man/generated_txt/cargo-test.txt
+++ b/src/doc/man/generated_txt/cargo-test.txt
@@ -52,6 +52,13 @@ DESCRIPTION
See the rustdoc book for more
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.
+
OPTIONS
Test Options
--no-run
diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md
index e1858c402c2..c3a7a2bbb19 100644
--- a/src/doc/src/commands/cargo-bench.md
+++ b/src/doc/src/commands/cargo-bench.md
@@ -56,6 +56,14 @@ debugger.
[`bench` profile]: ../reference/profiles.html#bench
+### Working directory of benchmarks
+
+The working directory of every benchmark is set to the root directory of the
+package the benchmark belongs to.
+Setting the working directory of benchmarks to the package's root directory
+makes it possible for benchmarks to reliably access the package's files using
+relative paths, regardless from where `cargo bench` was executed from.
+
## OPTIONS
### Benchmark Options
diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md
index 396c2d499dd..7e9d7c630fb 100644
--- a/src/doc/src/commands/cargo-run.md
+++ b/src/doc/src/commands/cargo-run.md
@@ -17,6 +17,10 @@ All the arguments following the two dashes (`--`) are passed to the binary to
run. If you're passing arguments to both Cargo and the binary, the ones after
`--` go to the binary, the ones before go to Cargo.
+Unlike [cargo-test(1)](cargo-test.html) and [cargo-bench(1)](cargo-bench.html), `cargo run` sets the
+working directory of the binary executed to the current working directory, same
+as if it was executed in the shell directly.
+
## OPTIONS
### Package Selection
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index 0ba9dcc6148..8e936a2abc5 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -57,6 +57,14 @@ and may change in the future; beware of depending on it.
See the [rustdoc book](https://doc.rust-lang.org/rustdoc/) for more 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.
+
## OPTIONS
### Test Options
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index 8cc7195e517..30506fa8351 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -57,6 +57,12 @@ optimizations and disables debugging information. If you need to debug a
benchmark, you can use the \fB\-\-profile=dev\fR command\-line option to switch to
the dev profile. You can then run the debug\-enabled benchmark within a
debugger.
+.SS "Working directory of benchmarks"
+The working directory of every benchmark is set to the root directory of the
+package the benchmark belongs to.
+Setting the working directory of benchmarks to the package\[cq]s root directory
+makes it possible for benchmarks to reliably access the package\[cq]s files using
+relative paths, regardless from where \fBcargo bench\fR was executed from.
.SH "OPTIONS"
.SS "Benchmark Options"
.sp
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index b030ab99a13..5bb79f9e3c7 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -13,6 +13,10 @@ Run a binary or example of the local package.
All the arguments following the two dashes (\fB\-\-\fR) are passed to the binary to
run. If you\[cq]re passing arguments to both Cargo and the binary, the ones after
\fB\-\-\fR go to the binary, the ones before go to Cargo.
+.sp
+Unlike \fBcargo\-test\fR(1) and \fBcargo\-bench\fR(1), \fBcargo run\fR sets the
+working directory of the binary executed to the current working directory, same
+as if it was executed in the shell directly.
.SH "OPTIONS"
.SS "Package Selection"
By default, the package in the current working directory is selected. The \fB\-p\fR
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index 2cc443370fb..d32add4ecaf 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -53,6 +53,12 @@ and may change in the future; beware of depending on it.
.sp
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
+possible for tests to reliably access the package\[cq]s files using relative paths,
+regardless from where \fBcargo test\fR was executed from.
.SH "OPTIONS"
.SS "Test Options"
.sp