Skip to content

Commit 13b0b70

Browse files
committed
Update the user documentation on unstable features.
This attempts to make it clearer on the different ways unstable features can be activated.
1 parent 778b535 commit 13b0b70

File tree

1 file changed

+53
-15
lines changed

1 file changed

+53
-15
lines changed

src/doc/src/reference/unstable.md

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,62 @@
11
## Unstable Features
22

3-
Experimental Cargo features are only available on the nightly channel. You
4-
typically use one of the `-Z` flags to enable them. Run `cargo -Z help` to
5-
see a list of flags available.
3+
Experimental Cargo features are only available on the [nightly channel]. You
4+
are encouraged to experiment with these features to see if they meet your
5+
needs, and if there are any issues or problems. Check the linked tracking
6+
issues listed below for more information on the feature, and click the GitHub
7+
subscribe button if you want future updates.
68

7-
`-Z unstable-options` is a generic flag for enabling other unstable
8-
command-line flags. Options requiring this will be called out below.
9+
After some period of time, if the feature does not have any major concerns, it
10+
can be [stabilized], which will make it available on stable once the current
11+
nightly release reaches the stable channel (anywhere from 6 to 12 weeks).
912

10-
Anything which can be configured with a Z flag can also be set in the cargo
11-
config file (`.cargo/config.toml`) in the `unstable` table. For example:
13+
There are three different ways that unstable features can be enabled based on
14+
how the feature works:
1215

13-
```toml
14-
[unstable]
15-
mtime-on-use = true
16-
multitarget = true
17-
timings = ["html"]
18-
```
16+
* New syntax in `Cargo.toml` requires a `cargo-features` key at the top of
17+
`Cargo.toml`, before any tables. For example:
18+
19+
```toml
20+
# This specifies which new Cargo.toml features are enabled.
21+
cargo-features = ["test-dummy-unstable"]
22+
23+
[package]
24+
name = "my-package"
25+
version = "0.1.0"
26+
im-a-teapot = true # This is a new option enabled by test-dummy-unstable.
27+
```
28+
29+
* New command-line flags, options, and subcommands require the `-Z
30+
unstable-options` CLI option to also be included. For example, the new
31+
`--out-dir` option is only available on nightly:
32+
33+
```cargo +nightly build --out-dir=out -Z unstable-options```
34+
35+
* `-Z` command-line flags are used to enable new functionality that may not
36+
have an interface, or the interface has not yet been designed, or for more
37+
complex features that affect multiple parts of Cargo. For example, the
38+
[timings](#timings) feature can be enabled with:
1939

20-
Some unstable features will require you to specify the `cargo-features` key in
21-
`Cargo.toml`.
40+
```cargo +nightly build -Z timings```
41+
42+
Run `cargo -Z help` to see a list of flags available.
43+
44+
Anything which can be configured with a `-Z` flag can also be set in the
45+
cargo [config file] (`.cargo/config.toml`) in the `unstable` table. For
46+
example:
47+
48+
```toml
49+
[unstable]
50+
mtime-on-use = true
51+
multitarget = true
52+
timings = ["html"]
53+
```
54+
55+
Each new feature described below should explain how to use it.
56+
57+
[config file]: config.md
58+
[nightly channel]: ../../book/appendix-07-nightly-rust.html
59+
[stabilized]: https://doc.crates.io/contrib/process/unstable.html#stabilization
2260

2361
### extra-link-arg
2462
* Original Pull Request: [#7811](https://github.com/rust-lang/cargo/pull/7811)

0 commit comments

Comments
 (0)