From 0c4f3a1b7f5616b570f7359a4c3417c5e8ed052b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 10 Oct 2019 14:16:29 -0700 Subject: [PATCH] Try to clarify how crates are able to access force-unstable dependencies without a feature attribute. --- src/stability.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/stability.md b/src/stability.md index 6b32dff2..1db738cb 100644 --- a/src/stability.md +++ b/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