Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md
index c09f293565d..063f632102e 100644
--- a/src/doc/src/commands/cargo-run.md
+++ b/src/doc/src/commands/cargo-run.md
@@ -213,7 +213,7 @@ coming from rustc are still emitted. Cannot be used with human or <
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md
index 364c05fcb64..3e32e86b0e5 100644
--- a/src/doc/src/commands/cargo-rustc.md
+++ b/src/doc/src/commands/cargo-rustc.md
@@ -317,7 +317,7 @@ coming from rustc are still emitted. Cannot be used with human or <
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md
index 4e73cd5f937..faac1de877c 100644
--- a/src/doc/src/commands/cargo-rustdoc.md
+++ b/src/doc/src/commands/cargo-rustdoc.md
@@ -297,7 +297,7 @@ coming from rustc are still emitted. Cannot be used with human or <
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index 2b2246ada40..451bac49f68 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -424,7 +424,7 @@ coming from rustc are still emitted. Cannot be used with human or <
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-tree.md b/src/doc/src/commands/cargo-tree.md
index a656bc3cd1f..13b4fc750ac 100644
--- a/src/doc/src/commands/cargo-tree.md
+++ b/src/doc/src/commands/cargo-tree.md
@@ -233,7 +233,7 @@ single quotes or double quotes around each pattern.
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo-vendor.md b/src/doc/src/commands/cargo-vendor.md
index d17aa2167d2..aaba0bc724e 100644
--- a/src/doc/src/commands/cargo-vendor.md
+++ b/src/doc/src/commands/cargo-vendor.md
@@ -68,7 +68,7 @@ only a subset of the packages have changed.
Path to the Cargo.toml file. By default, Cargo searches for the
+
Path to the Cargo.toml or cargo script file. By default, Cargo searches for the
Cargo.toml file in the current directory or any parent directory.
diff --git a/src/doc/src/commands/cargo.md b/src/doc/src/commands/cargo.md
index 03676e24927..56481e2cf19 100644
--- a/src/doc/src/commands/cargo.md
+++ b/src/doc/src/commands/cargo.md
@@ -7,6 +7,7 @@ cargo --- The Rust package manager
## SYNOPSIS
`cargo` [_options_] _command_ [_args_]\
+`cargo` [_options_] _script_ [_args_]\
`cargo` [_options_] `--version`\
`cargo` [_options_] `--list`\
`cargo` [_options_] `--help`\
@@ -343,7 +344,11 @@ stable yet and may be subject to change.
mkdir foo && cd foo
cargo init .
-6. Learn about a command's options and usage:
+6. Run a script
+
+ cargo task.rs --action
+
+7. Learn about a command's options and usage:
cargo help clean
diff --git a/src/doc/src/reference/cargo-targets.md b/src/doc/src/reference/cargo-targets.md
index 47021a1ce3b..7c905476c5e 100644
--- a/src/doc/src/reference/cargo-targets.md
+++ b/src/doc/src/reference/cargo-targets.md
@@ -363,6 +363,9 @@ autobins = false
> is `false` if at least one target is manually defined in `Cargo.toml`.
> Beginning with the 2018 edition, the default is always `true`.
+> **Note:** Scripts are self-contained and do not support additional targets
+> nor controlling target discovery.
+
> **MSRV:** Respected as of 1.27 for `autobins`, `autoexamples`, `autotests`, and `autobenches`
> **MSRV:** Respected as of 1.83 for `autolib`
diff --git a/src/doc/src/reference/manifest.md b/src/doc/src/reference/manifest.md
index 5f1074f8ea5..4fa38d1e88c 100644
--- a/src/doc/src/reference/manifest.md
+++ b/src/doc/src/reference/manifest.md
@@ -4,6 +4,22 @@ The `Cargo.toml` file for each package is called its *manifest*. It is written
in the [TOML] format. It contains metadata that is needed to compile the package. Checkout
the `cargo locate-project` section for more detail on how cargo finds the manifest file.
+The content of the manifest can also be embedded inside of the frontmatter inside of a Rust source file:
+```rust
+#!/usr/bin/env cargo
+---
+[package]
+edition = "2024"
+
+[dependencies]
+regex = "1"
+---
+
+fn main() {
+ // ...
+}
+```
+
Every manifest file consists of the following sections:
* [`cargo-features`](unstable.md) --- Unstable, nightly-only features.
@@ -66,10 +82,11 @@ name = "hello_world" # the name of the package
version = "0.1.0" # the current version, obeying semver
```
-The only field required by Cargo is [`name`](#the-name-field). If publishing to
-a registry, the registry may require additional fields. See the notes below and
-[the publishing chapter][publishing] for requirements for publishing to
-[crates.io].
+The only field required by Cargo for `Cargo.toml` files is [`name`](#the-name-field).
+There are no required fields for cargo scripts.
+If publishing to a registry, the registry may require additional fields. See
+the notes below and [the publishing chapter][publishing] for requirements for
+publishing to [crates.io].
### The `name` field
@@ -88,6 +105,9 @@ a keyword. [crates.io] imposes even more restrictions, such as:
- Do not use special Windows names such as "nul".
- Use a maximum of 64 characters of length.
+This field is optional for scripts and defaults to the file stem.
+The field is required for `Cargo.toml` manifests.
+
[alphanumeric]: ../../std/primitive.char.html#method.is_alphanumeric
### The `version` field
@@ -154,7 +174,9 @@ with the latest stable edition. By default `cargo new` creates a manifest with
the 2024 edition currently.
If the `edition` field is not present in `Cargo.toml`, then the 2015 edition is
-assumed for backwards compatibility. Note that all manifests
+assumed for backwards compatibility.
+In scripts, the current edition is assumed.
+Note that all manifests
created with [`cargo new`] will not use this historical fallback because they
will have `edition` explicitly specified to a newer value.
@@ -328,6 +350,8 @@ table defined. That is, a crate cannot both be a root crate in a workspace
For more information, see the [workspaces chapter](workspaces.md).
+This field is disallowed in scripts.
+
### The `build` field
The `build` field specifies a file in the package root which is a [build
@@ -347,6 +371,8 @@ The default is `"build.rs"`, which loads the script from a file named
specify a path to a different file or `build = false` to disable automatic
detection of the build script.
+This field is disallowed in scripts.
+
### The `links` field
The `links` field specifies the name of a native library that is being linked
@@ -364,6 +390,8 @@ on Linux) may specify:
links = "git2"
```
+This field is disallowed in scripts.
+
### The `exclude` and `include` fields
The `exclude` and `include` fields can be used to explicitly specify which
@@ -519,6 +547,8 @@ both `src/bin/a.rs` and `src/bin/b.rs`:
default-run = "a"
```
+This field is disallowed in scripts.
+
## The `[lints]` section
Override the default level of lints from different tools by assigning them to a new level in a
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index 6ca6f108044..0976cf46b7a 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -129,7 +129,6 @@ Each new feature described below should explain how to use it.
* [asymmetric-token](#asymmetric-token) --- Adds support for authentication tokens using asymmetric cryptography (`cargo:paseto` provider).
* Other
* [gitoxide](#gitoxide) --- Use `gitoxide` instead of `git2` for a set of operations.
- * [script](#script) --- Enable support for single-file `.rs` packages.
* [lockfile-path](#lockfile-path) --- Allows to specify a path to lockfile other than the default path `/Cargo.lock`.
* [native-completions](#native-completions) --- Move cargo shell completions to native completions.
* [warnings](#warnings) --- controls warning behavior; options for allowing or denying warnings.
@@ -1380,99 +1379,6 @@ Valid operations are the following:
* When the unstable feature is on, fetching/cloning a git repository is always a shallow fetch. This roughly equals to `git fetch --depth 1` everywhere.
* Even with the presence of `Cargo.lock` or specifying a commit `{ rev = "…" }`, gitoxide and libgit2 are still smart enough to shallow fetch without unshallowing the existing repository.
-## script
-
-* Tracking Issue: [#12207](https://github.com/rust-lang/cargo/issues/12207)
-
-Cargo can directly run `.rs` files as:
-```console
-$ cargo +nightly -Zscript file.rs
-```
-where `file.rs` can be as simple as:
-```rust
-fn main() {}
-```
-
-A user may optionally specify a manifest in a `cargo` code fence in a module-level comment, like:
-````rust
-#!/usr/bin/env -S cargo +nightly -Zscript
----cargo
-[dependencies]
-clap = { version = "4.2", features = ["derive"] }
----
-
-use clap::Parser;
-
-#[derive(Parser, Debug)]
-#[clap(version)]
-struct Args {
- #[clap(short, long, help = "Path to config")]
- config: Option,
-}
-
-fn main() {
- let args = Args::parse();
- println!("{:?}", args);
-}
-````
-
-### Single-file packages
-
-In addition to today's multi-file packages (`Cargo.toml` file with other `.rs`
-files), we are adding the concept of single-file packages which may contain an
-embedded manifest. There is no required distinguishment for a single-file
-`.rs` package from any other `.rs` file.
-
-Single-file packages may be selected via `--manifest-path`, like
-`cargo test --manifest-path foo.rs`. Unlike `Cargo.toml`, these files cannot be auto-discovered.
-
-A single-file package may contain an embedded manifest. An embedded manifest
-is stored using `TOML` in rust "frontmatter", a markdown code-fence with `cargo`
-at the start of the infostring at the top of the file.
-
-Inferred / defaulted manifest fields:
-- `package.name = `
-- `package.edition = ` to avoid always having to add an embedded
- manifest at the cost of potentially breaking scripts on rust upgrades
- - Warn when `edition` is unspecified to raise awareness of this
-
-Disallowed manifest fields:
-- `[workspace]`, `[lib]`, `[[bin]]`, `[[example]]`, `[[test]]`, `[[bench]]`
-- `package.workspace`, `package.build`, `package.links`, `package.autolib`, `package.autobins`, `package.autoexamples`, `package.autotests`, `package.autobenches`
-
-The default `CARGO_TARGET_DIR` for single-file packages is at `$CARGO_HOME/target/`:
-- Avoid conflicts from multiple single-file packages being in the same directory
-- Avoid problems with the single-file package's parent directory being read-only
-- Avoid cluttering the user's directory
-
-The lockfile for single-file packages will be placed in `CARGO_TARGET_DIR`. In
-the future, when workspaces are supported, that will allow a user to have a
-persistent lockfile.
-
-### Manifest-commands
-
-You may pass a manifest directly to the `cargo` command, without a subcommand,
-like `foo/Cargo.toml` or a single-file package like `foo.rs`. This is mostly
-intended for being put in `#!` lines.
-
-The precedence for how to interpret `cargo ` is
-1. Built-in xor single-file packages
-2. Aliases
-3. External subcommands
-
-A parameter is identified as a manifest-command if it has one of:
-- Path separators
-- A `.rs` extension
-- The file name is `Cargo.toml`
-
-Differences between `cargo run --manifest-path ` and `cargo `
-- `cargo ` runs with the config for `` and not the current dir, more like `cargo install --path `
-- `cargo ` is at a verbosity level below the normal default. Pass `-v` to get normal output.
-
-When running a package with an embedded manifest,
-[`arg0`](https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.arg0) will be the scripts path.
-To get the executable's path, see [`current_exe`](https://doc.rust-lang.org/std/env/fn.current_exe.html).
-
### Documentation Updates
## Profile `trim-paths` option
@@ -2343,3 +2249,7 @@ See the [`include` config documentation](config.md#include) for more.
## pubtime
The `pubtime` index field has been stabilized in Rust 1.94.0.
+
+## Cargo script
+
+Support for `-Zscript` has been stabilized in 1.95.0.
diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1
index 84a3d528dfd..536373a27e4 100644
--- a/src/etc/man/cargo-add.1
+++ b/src/etc/man/cargo-add.1
@@ -208,7 +208,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index 998c747ceca..f2967053aef 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -410,7 +410,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index c90c2200ead..5120c2d936b 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -317,7 +317,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index e5c1d2f090c..b334c7efc20 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -308,7 +308,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1
index bbdebd3c8af..8a525249141 100644
--- a/src/etc/man/cargo-clean.1
+++ b/src/etc/man/cargo-clean.1
@@ -128,7 +128,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 891fe20f890..e9043a9f1d1 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -277,7 +277,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1
index 41fa1d60b1e..fb6bd424362 100644
--- a/src/etc/man/cargo-fetch.1
+++ b/src/etc/man/cargo-fetch.1
@@ -91,7 +91,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index fd73fa0f5cb..812709cd1d4 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -403,7 +403,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1
index 04d609a8e0a..45809e6309a 100644
--- a/src/etc/man/cargo-generate-lockfile.1
+++ b/src/etc/man/cargo-generate-lockfile.1
@@ -58,7 +58,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-locate-project.1 b/src/etc/man/cargo-locate-project.1
index 83f7876a480..9225c3cc16a 100644
--- a/src/etc/man/cargo-locate-project.1
+++ b/src/etc/man/cargo-locate-project.1
@@ -79,7 +79,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.SS "Common Options"
diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1
index ad6dee4ebb5..fce6b8987bb 100644
--- a/src/etc/man/cargo-metadata.1
+++ b/src/etc/man/cargo-metadata.1
@@ -442,7 +442,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1
index 0e162bbfd12..ad8fa68605a 100644
--- a/src/etc/man/cargo-package.1
+++ b/src/etc/man/cargo-package.1
@@ -299,7 +299,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1
index 94c4fd1ea42..45b8ec4bc45 100644
--- a/src/etc/man/cargo-pkgid.1
+++ b/src/etc/man/cargo-pkgid.1
@@ -117,7 +117,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1
index a41c729ff1f..aa5d3136088 100644
--- a/src/etc/man/cargo-publish.1
+++ b/src/etc/man/cargo-publish.1
@@ -180,7 +180,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1
index 15d964f9981..d213c8d77fc 100644
--- a/src/etc/man/cargo-remove.1
+++ b/src/etc/man/cargo-remove.1
@@ -77,7 +77,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index 2e95cf4f7f3..75787c64bf9 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -212,7 +212,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index 971c9218716..0c35dfd69f4 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -327,7 +327,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index c624de72c2f..c4eedd84038 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -294,7 +294,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index 57175befad3..ce8cd8aa636 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -437,7 +437,7 @@ coming from rustc are still emitted. Cannot be used with \fBhuman\fR or \fBshort
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1
index 8dbda8778d2..a6a496fab57 100644
--- a/src/etc/man/cargo-tree.1
+++ b/src/etc/man/cargo-tree.1
@@ -265,7 +265,7 @@ single quotes or double quotes around each pattern.
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1
index 3b6a86d91d7..d4d67525ddd 100644
--- a/src/etc/man/cargo-update.1
+++ b/src/etc/man/cargo-update.1
@@ -134,7 +134,7 @@ May also be specified with the \fBterm.color\fR
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo-vendor.1 b/src/etc/man/cargo-vendor.1
index 0182f8eb37f..49ba9fdcfce 100644
--- a/src/etc/man/cargo-vendor.1
+++ b/src/etc/man/cargo-vendor.1
@@ -58,7 +58,7 @@ only a subset of the packages have changed.
.sp
\fB\-\-manifest\-path\fR \fIpath\fR
.RS 4
-Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
+Path to the \fBCargo.toml\fR or cargo script file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
diff --git a/src/etc/man/cargo.1 b/src/etc/man/cargo.1
index 80c8682a6ef..df149d2ca40 100644
--- a/src/etc/man/cargo.1
+++ b/src/etc/man/cargo.1
@@ -8,6 +8,8 @@ cargo \[em] The Rust package manager
.SH "SYNOPSIS"
\fBcargo\fR [\fIoptions\fR] \fIcommand\fR [\fIargs\fR]
.br
+\fBcargo\fR [\fIoptions\fR] \fIscript\fR [\fIargs\fR]
+.br
\fBcargo\fR [\fIoptions\fR] \fB\-\-version\fR
.br
\fBcargo\fR [\fIoptions\fR] \fB\-\-list\fR
@@ -400,7 +402,17 @@ cargo init .
.RE
.sp
.RS 4
-\h'-04' 6.\h'+01'Learn about a command\[cq]s options and usage:
+\h'-04' 6.\h'+01'Run a script
+.sp
+.RS 4
+.nf
+cargo task.rs \-\-action
+.fi
+.RE
+.RE
+.sp
+.RS 4
+\h'-04' 7.\h'+01'Learn about a command\[cq]s options and usage:
.sp
.RS 4
.nf
diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs
index eabe76ea77f..70b102449f8 100644
--- a/tests/testsuite/build.rs
+++ b/tests/testsuite/build.rs
@@ -349,7 +349,7 @@ fn cargo_compile_with_unsupported_short_unstable_feature_flag() {
tip: a similar argument exists: '-Z'
Usage: cargo [..][OPTIONS] [COMMAND]
- cargo [..][OPTIONS] -Zscript [ARGS]...
+ cargo [..][OPTIONS] [ARGS]...
For more information, try '--help'.
diff --git a/tests/testsuite/cargo/help/stdout.term.svg b/tests/testsuite/cargo/help/stdout.term.svg
index bf54694dbf9..c0a44aaf795 100644
--- a/tests/testsuite/cargo/help/stdout.term.svg
+++ b/tests/testsuite/cargo/help/stdout.term.svg
@@ -1,7 +1,7 @@