Try to clarify how crates are able to access force-unstable dependencies

without a feature attribute.
This commit is contained in:
Eric Huss 2019-10-10 14:16:29 -07:00 committed by Who? Me?!
parent 226b37eaa0
commit 0c4f3a1b7f
1 changed files with 11 additions and 7 deletions

View File

@ -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