diff options
| author | Eric Huss <eric@huss.org> | 2019-10-10 14:16:29 -0700 |
|---|---|---|
| committer | Who? Me?! <mark-i-m@users.noreply.github.com> | 2019-10-10 21:00:58 -0500 |
| commit | 5f6b2976ee5b42e0bec48bec82c3db475f78ebba (patch) | |
| tree | 6a9ec133dcbe2ebe1b03ca8a420cf9b301ce5719 /src/doc/rustc-dev-guide | |
| parent | 80a92c5bd5bbedc80495698d401174609e6236fa (diff) | |
| download | rust-5f6b2976ee5b42e0bec48bec82c3db475f78ebba.tar.gz rust-5f6b2976ee5b42e0bec48bec82c3db475f78ebba.zip | |
Try to clarify how crates are able to access force-unstable dependencies
without a feature attribute.
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/stability.md | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/src/stability.md b/src/doc/rustc-dev-guide/src/stability.md index 6b32dff2d53..1db738cb2f5 100644 --- a/src/doc/rustc-dev-guide/src/stability.md +++ b/src/doc/rustc-dev-guide/src/stability.md @@ -99,12 +99,12 @@ default `allow`, but most of the standard library raises it to a warning with ## -Zforce-unstable-if-unmarked The `-Zforce-unstable-if-unmarked` flag has a variety of purposes to help -enforce that the correct crates are marked as unstable, but can still use -private crates without special attributes. It was introduced primarily to -allow rustc and the standard library to link to arbitrary crates on crates.io -which do not themselves use `staged_api`. `rustc` also relies on this flag to -mark all of its crates as unstable with the `rustc_private` feature so that -each crate does not need to be carefully marked with `unstable`. +enforce that the correct crates are marked as unstable. It was introduced +primarily to allow rustc and the standard library to link to arbitrary crates +on crates.io which do not themselves use `staged_api`. `rustc` also relies on +this flag to mark all of its crates as unstable with the `rustc_private` +feature so that each crate does not need to be carefully marked with +`unstable`. This flag is automatically applied to all of `rustc` and the standard library by the bootstrap scripts. This is needed because the compiler and all of its @@ -115,7 +115,11 @@ This flag has the following effects: - Marks the crate as "unstable" with the `rustc_private` feature if it is not itself marked as stable or unstable. - Allows these crates to access other forced-unstable crates without any need - for attributes. + for attributes. Normally a crate would need a `#![feature(rustc_private)]` + attribute to use other unstable crates. However, that would make it + impossible for a crate from crates.io to access its own dependencies since + that crate won't have a `feature(rustc_private)` attribute, but *everything* + is compiled with `-Zforce-unstable-if-unmarked`. Code which does not use `-Zforce-unstable-if-unmarked` should include the `#![feature(rustc_private)]` crate attribute to access these force-unstable |
