Skip to content

Commit 1a0cc37

Browse files
committed
document -Z allow-features
1 parent e36fdd7 commit 1a0cc37

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# `allow-features`
2+
3+
This feature is perma-unstable and has no tracking issue.
4+
5+
----
6+
7+
This flag allows limiting the features which can be enabled with `#![feature(...)]` attributes.
8+
By default, all features are allowed on nightly and no features are allowed on stable or beta (but see [`RUSTC_BOOTSTRAP`]).
9+
10+
Features are comma-separated, for example `-Z allow-features=ffi_pure,f16`.
11+
If the flag is present, any feature listed will be allowed and any feature not listed will be disallowed.
12+
Any unrecognized feature is ignored.
13+
14+
[`RUSTC_BOOTSTRAP`]: ./rustc-bootstrap.html

Diff for: src/doc/unstable-book/src/compiler-flags/rustc-bootstrap.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Setting `RUSTC_BOOTSTRAP=1` instructs rustc to enable this for all crates.
1111
Setting `RUSTC_BOOTSTRAP=crate_name` instructs rustc to only apply this to crates named `crate_name`.
1212
Setting `RUSTC_BOOTSTRAP=-1` instructs rustc to act as if it is a stable compiler, even on the nightly release channel.
1313
Cargo disallows setting `cargo::rustc-env=RUSTC_BOOTSTRAP` in build scripts.
14-
Crates can fully opt out of unstable features by using `#![forbid(unstable_features)]` at the crate root (or any other way of enabling lints, such as `-F unstable-features`).
14+
Build systems can limit the features they enable with [`-Z allow-features=feature1,feature2`][Z-allow-features].
15+
Crates can fully opt out of unstable features by using [`#![forbid(unstable_features)]`][unstable-features] at the crate root (or any other way of enabling lints, such as `-F unstable-features`).
16+
17+
[Z-allow-features]: ./allow-features.html
18+
[unstable-features]: ../../rustc/lints/listing/allowed-by-default.html#unstable-features
1519

1620
## Why does this environment variable exist?
1721

0 commit comments

Comments
 (0)