Skip to content

Commit

Permalink
Try to clarify how crates are able to access force-unstable dependencies
Browse files Browse the repository at this point in the history
without a feature attribute.
  • Loading branch information
ehuss authored and mark-i-m committed Oct 11, 2019
1 parent e6f625f commit 799082b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/stability.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 799082b

Please sign in to comment.