Skip to content

Commit 29ea494

Browse files
committed
Auto merge of #9457 - ehuss:unstable-doc-updates, r=alexcrichton
Some updates to the unstable documentation * Extends the future-incompat docs. * Adds `cargo rustc --print` * Adds a table of contents. The chapter is really long and unorganized, so I hope this can maybe help make things easier to discover.
2 parents f8cb939 + fa3761c commit 29ea494

File tree

3 files changed

+77
-6
lines changed

3 files changed

+77
-6
lines changed

src/bin/cargo/commands/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
7575
if let Some(opt_value) = args.value_of(PRINT_ARG_NAME) {
7676
config
7777
.cli_unstable()
78-
.fail_if_stable_opt(PRINT_ARG_NAME, 8923)?;
78+
.fail_if_stable_opt(PRINT_ARG_NAME, 9357)?;
7979
ops::print(&ws, &compile_opts, opt_value)?;
8080
} else {
8181
ops::compile(&ws, &compile_opts)?;

src/cargo/util/command_prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ pub trait ArgMatchesExt {
485485
if build_config.future_incompat_report {
486486
config
487487
.cli_unstable()
488-
// TODO: Tracking issue
489488
.fail_if_stable_opt("--future-incompat-report", 9241)?;
490489

491490
if !config.cli_unstable().future_incompat_report {

src/doc/src/reference/unstable.md

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,55 @@ Each new feature described below should explain how to use it.
5858
[nightly channel]: ../../book/appendix-07-nightly-rust.html
5959
[stabilized]: https://doc.crates.io/contrib/process/unstable.html#stabilization
6060

61+
### List of unstable features
62+
63+
* Unstable-specific features
64+
* [-Z allow-features](#allow-features) — Provides a way to restrict which unstable features are used.
65+
* Build scripts and linking
66+
* [extra-link-arg](#extra-link-arg) — Allows build scripts to pass extra link arguments in more cases.
67+
* [Metabuild](#metabuild) — Provides declarative build scripts.
68+
* Resolver and features
69+
* [no-index-update](#no-index-update) — Prevents cargo from updating the index cache.
70+
* [avoid-dev-deps](#avoid-dev-deps) — Prevents the resolver from including dev-dependencies during resolution.
71+
* [minimal-versions](#minimal-versions) — Forces the resolver to use the lowest compatible version instead of the highest.
72+
* [public-dependency](#public-dependency) — Allows dependencies to be classified as either public or private.
73+
* [Namespaced features](#namespaced-features) — Separates optional dependencies into a separate namespace from regular features, and allows feature names to be the same as some dependency name.
74+
* [Weak dependency features](#weak-dependency-features) — Allows setting features for dependencies without enabling optional dependencies.
75+
* Output behavior
76+
* [out-dir](#out-dir) — Adds a directory where artifacts are copied to.
77+
* [terminal-width](#terminal-width) — Tells rustc the width of the terminal so that long diagnostic messages can be truncated to be more readable.
78+
* Compile behavior
79+
* [mtime-on-use](#mtime-on-use) — Updates the last-modified timestamp on every dependency every time it is used, to provide a mechanism to delete unused artifacts.
80+
* [doctest-xcompile](#doctest-xcompile) — Supports running doctests with the `--target` flag.
81+
* [multitarget](#multitarget) — Supports building for multiple targets at the same time.
82+
* [build-std](#build-std) — Builds the standard library instead of using pre-built binaries.
83+
* [build-std-features](#build-std-features) — Sets features to use with the standard library.
84+
* [binary-dep-depinfo](#binary-dep-depinfo) — Causes the dep-info file to track binary dependencies.
85+
* [panic-abort-tests](#panic-abort-tests) — Allows running tests with the "abort" panic strategy.
86+
* rustdoc
87+
* [`doctest-in-workspace`](#doctest-in-workspace) — Fixes workspace-relative paths when running doctests.
88+
* [rustdoc-map](#rustdoc-map) — Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/).
89+
* `Cargo.toml` extensions
90+
* [Custom named profiles](#custom-named-profiles) — Adds custom named profiles in addition to the standard names.
91+
* [Profile `strip` option](#profile-strip-option) — Forces the removal of debug information and symbols from executables.
92+
* [per-package-target](#per-package-target) — Sets the `--target` to use for each individual package.
93+
* [rust-version](#rust-version) — Allows to declare the minimum supported Rust version.
94+
* [Edition 2021](#edition-2021) — Adds support for the 2021 Edition.
95+
* Information and metadata
96+
* [Build-plan](#build-plan) — Emits JSON information on which commands will be run.
97+
* [timings](#timings) — Generates a report on how long individual dependencies took to run.
98+
* [unit-graph](#unit-graph) — Emits JSON for Cargo's internal graph structure.
99+
* [future incompat report](#future-incompat-report) — Displays a report for future incompatibilities that may error in the future.
100+
* Configuration
101+
* [config-cli](#config-cli) — Adds the ability to pass configuration options on the command-line.
102+
* [config-include](#config-include) — Adds the ability for config files to include other files.
103+
* [configurable-env](#configurable-env) — Adds support for defining environment variables that will be set when building and running.
104+
* [patch-in-config](#patch-in-config) — Adds support for specifying the `[patch]` table in config files.
105+
* [`cargo config`](#cargo-config) — Adds a new subcommand for viewing config files.
106+
* Registries
107+
* [credential-process](#credential-process) — Adds support for fetching registry tokens from an external authentication program.
108+
* [`cargo logout`](#cargo-logout) — Adds the `logout` command to remove the currently saved registry token.
109+
61110
### allow-features
62111

63112
This permanently-unstable flag makes it so that only a listed set of
@@ -1150,9 +1199,18 @@ The 2021 edition will set the default [resolver version] to "2".
11501199
* RFC: [#2834](https://github.com/rust-lang/rfcs/blob/master/text/2834-cargo-report-future-incompat.md)
11511200
* rustc Tracking Issue: [#71249](https://github.com/rust-lang/rust/issues/71249)
11521201

1153-
The `-Z future-incompat-report` flag enables the creation of a future-incompat report
1154-
for all dependencies. This makes users aware if any of their crate's dependencies
1155-
might stop compiling with a future version of Rust.
1202+
The `-Z future-incompat-report` flag causes Cargo to check for
1203+
future-incompatible warnings in all dependencies. These are warnings for
1204+
changes that may become hard errors in the future, causing the dependency to
1205+
stop building in a future version of rustc. If any warnings are found, a small
1206+
notice is displayed indicating that the warnings were found, and provides
1207+
instructions on how to display a full report.
1208+
1209+
A full report can be displayed with the `cargo report future-incompatibilities
1210+
-Z future-incompat-report --id ID` command, or by running the build again with
1211+
the `--future-incompat-report` flag. The developer should then update their
1212+
dependencies to a version where the issue is fixed, or work with the
1213+
developers of the dependencies to help resolve the issue.
11561214

11571215
### configurable-env
11581216
* Original Pull Request: [#9175](https://github.com/rust-lang/cargo/pull/9175)
@@ -1205,7 +1263,7 @@ lowest precedence.
12051263
Relative `path` dependencies in such a `[patch]` section are resolved
12061264
relative to the configuration file they appear in.
12071265

1208-
## `cargo config`
1266+
### `cargo config`
12091267

12101268
* Original Issue: [#2362](https://github.com/rust-lang/cargo/issues/2362)
12111269
* Tracking Issue: [#9301](https://github.com/rust-lang/cargo/issues/9301)
@@ -1239,6 +1297,20 @@ from the root of the workspace. It also passes the `--test-run-directory` to
12391297
package. This preserves backwards compatibility and is consistent with how
12401298
normal unittests are run.
12411299

1300+
### rustc `--print`
1301+
1302+
* Tracking Issue: [#9357](https://github.com/rust-lang/cargo/issues/9357)
1303+
1304+
`cargo rustc --print=VAL` forwards the `--print` flag to `rustc` in order to
1305+
extract information from `rustc`. This runs `rustc` with the corresponding
1306+
[`--print`](https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information)
1307+
flag, and then immediately exits without compiling. Exposing this as a cargo
1308+
flag allows cargo to inject the correct target and RUSTFLAGS based on the
1309+
current configuration.
1310+
1311+
The primary use case is to run `cargo rustc --print=cfg` to get config values
1312+
for the appropriate target and influenced by any other RUSTFLAGS.
1313+
12421314
<script>
12431315
(function() {
12441316
var fragments = {

0 commit comments

Comments
 (0)