about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-06-22 06:30:12 -0600
committerGitHub <noreply@github.com>2017-06-22 06:30:12 -0600
commit7f693e2cb9455fcfbe4de69236abc6a0ef98624b (patch)
tree499dd45c3dff5ed1a0dd5f22bc318d6b523eafdc /src
parentea7db0787d9e03ffbe7e3f9aea2875ea077fc1e8 (diff)
parentae1dc2a6f902cea5b6e833497b11d8860acabfd9 (diff)
downloadrust-7f693e2cb9455fcfbe4de69236abc6a0ef98624b.tar.gz
rust-7f693e2cb9455fcfbe4de69236abc6a0ef98624b.zip
Rollup merge of #42806 - ollie27:rustbuild_compiler_docs, r=alexcrichton
rustbuild: Fix compiler docs yet again

Add support for `-Z force-unstable-if-unmarked` to rustdoc.

r? @alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bin/rustdoc.rs10
-rw-r--r--src/librustdoc/core.rs7
-rw-r--r--src/librustdoc/lib.rs6
3 files changed, 16 insertions, 7 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index 3a1a9c3e40d..d7d72d5dd56 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -41,11 +41,11 @@ fn main() {
         .env(bootstrap::util::dylib_path_var(),
              env::join_paths(&dylib_path).unwrap());
 
-    // Pass the `rustbuild` feature flag to crates which rustbuild is
-    // building. See the comment in bootstrap/lib.rs where this env var is
-    // set for more details.
-    if env::var_os("RUSTBUILD_UNSTABLE").is_some() {
-        cmd.arg("--cfg").arg("rustbuild");
+    // Force all crates compiled by this compiler to (a) be unstable and (b)
+    // allow the `rustc_private` feature to link to other unstable crates
+    // also in the sysroot.
+    if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
+        cmd.arg("-Z").arg("force-unstable-if-unmarked");
     }
 
     std::process::exit(match cmd.status() {
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 9a689ed079e..62b91feb09d 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -106,7 +106,8 @@ pub fn run_core(search_paths: SearchPaths,
                 input: Input,
                 triple: Option<String>,
                 maybe_sysroot: Option<PathBuf>,
-                allow_warnings: bool) -> (clean::Crate, RenderInfo)
+                allow_warnings: bool,
+                force_unstable_if_unmarked: bool) -> (clean::Crate, RenderInfo)
 {
     // Parse, resolve, and typecheck the given crate.
 
@@ -128,6 +129,10 @@ pub fn run_core(search_paths: SearchPaths,
         // Ensure that rustdoc works even if rustc is feature-staged
         unstable_features: UnstableFeatures::Allow,
         actually_rustdoc: true,
+        debugging_opts: config::DebuggingOptions {
+            force_unstable_if_unmarked: force_unstable_if_unmarked,
+            ..config::basic_debugging_options()
+        },
         ..config::basic_options().clone()
     };
 
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 496662f442c..6c092d01a01 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -465,13 +465,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
     info!("starting to run rustc");
     let display_warnings = matches.opt_present("display-warnings");
 
+    let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| {
+        *x == "force-unstable-if-unmarked"
+    });
+
     let (tx, rx) = channel();
     rustc_driver::monitor(move || {
         use rustc::session::config::Input;
 
         let (mut krate, renderinfo) =
             core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
-                           display_warnings);
+                           display_warnings, force_unstable_if_unmarked);
 
         info!("finished with rustc");