Skip to content

Commit 76f080b

Browse files
committed
Auto merge of #10770 - wmstack:master, r=weihanglo
Indicate how Cargo locates the manifest Currently the only place where that is documented is in an obscure flag called `--manifest-path`. The behaviour of Cargo in regards to locating the manifest should be in a more obvious place, and this seems to be right about where I added it.
2 parents 928561a + 1a88627 commit 76f080b

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

src/doc/man/cargo-locate-project.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ cargo-locate-project - Print a JSON representation of a Cargo.toml file's locati
1010

1111
## DESCRIPTION
1212

13-
This command will print a JSON object to stdout with the full path to the
14-
`Cargo.toml` manifest.
13+
This command will print a JSON object to stdout with the full path to the manifest. The
14+
manifest is found by searching upward for a file named `Cargo.toml` starting from the current
15+
working directory.
16+
17+
If the project happens to be a part of a workspace, the manifest of the project, rather than
18+
the workspace root, is output. This can be overriden by the `--workspace` flag. The root
19+
workspace is found by traversing further upward or by using the field `package.workspace` after
20+
locating the manifest of a workspace member.
1521

1622
## OPTIONS
1723

src/doc/man/generated_txt/cargo-locate-project.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ SYNOPSIS
99

1010
DESCRIPTION
1111
This command will print a JSON object to stdout with the full path to
12-
the Cargo.toml manifest.
12+
the manifest. The manifest is found by searching upward for a file named
13+
Cargo.toml starting from the current working directory.
14+
15+
If the project happens to be a part of a workspace, the manifest of the
16+
project, rather than the workspace root, is output. This can be
17+
overriden by the --workspace flag. The root workspace is found by
18+
traversing further upward or by using the field package.workspace after
19+
locating the manifest of a workspace member.
1320

1421
OPTIONS
1522
--workspace

src/doc/src/commands/cargo-locate-project.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ cargo-locate-project - Print a JSON representation of a Cargo.toml file's locati
1010

1111
## DESCRIPTION
1212

13-
This command will print a JSON object to stdout with the full path to the
14-
`Cargo.toml` manifest.
13+
This command will print a JSON object to stdout with the full path to the manifest. The
14+
manifest is found by searching upward for a file named `Cargo.toml` starting from the current
15+
working directory.
16+
17+
If the project happens to be a part of a workspace, the manifest of the project, rather than
18+
the workspace root, is output. This can be overriden by the `--workspace` flag. The root
19+
workspace is found by traversing further upward or by using the field `package.workspace` after
20+
locating the manifest of a workspace member.
1521

1622
## OPTIONS
1723

src/doc/src/reference/manifest.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
## The Manifest Format
22

33
The `Cargo.toml` file for each package is called its *manifest*. It is written
4-
in the [TOML] format. Every manifest file consists of the following sections:
4+
in the [TOML] format. It contains metadata that is needed to compile the package. Checkout
5+
the `cargo locate-project` section for more detail on how cargo finds the manifest file.
6+
7+
Every manifest file consists of the following sections:
58

69
* [`cargo-features`](unstable.md) — Unstable, nightly-only features.
710
* [`[package]`](#the-package-section) — Defines a package.

src/etc/man/cargo-locate-project.1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ cargo\-locate\-project \- Print a JSON representation of a Cargo.toml file's loc
88
.SH "SYNOPSIS"
99
\fBcargo locate\-project\fR [\fIoptions\fR]
1010
.SH "DESCRIPTION"
11-
This command will print a JSON object to stdout with the full path to the
12-
\fBCargo.toml\fR manifest.
11+
This command will print a JSON object to stdout with the full path to the manifest. The
12+
manifest is found by searching upward for a file named \fBCargo.toml\fR starting from the current
13+
working directory.
14+
.sp
15+
If the project happens to be a part of a workspace, the manifest of the project, rather than
16+
the workspace root, is output. This can be overriden by the \fB\-\-workspace\fR flag. The root
17+
workspace is found by traversing further upward or by using the field \fBpackage.workspace\fR after
18+
locating the manifest of a workspace member.
1319
.SH "OPTIONS"
1420
.sp
1521
\fB\-\-workspace\fR

0 commit comments

Comments
 (0)