]> git.lizzy.rs Git - rust.git/commitdiff
rustbuild: Fix compiler docs yet again
authorOliver Middleton <olliemail27@gmail.com>
Wed, 21 Jun 2017 16:59:10 +0000 (17:59 +0100)
committerOliver Middleton <olliemail27@gmail.com>
Wed, 21 Jun 2017 16:59:10 +0000 (17:59 +0100)
Add support for `-Z force-unstable-if-unmarked` to rustdoc.

src/bootstrap/bin/rustdoc.rs
src/librustdoc/core.rs
src/librustdoc/lib.rs

index 3a1a9c3e40d66066b708f48e2de876d38d7fa702..d7d72d5dd56c9eeff762b688bd2e513fdb633a64 100644 (file)
@@ -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() {
index 9a689ed079ee259f8240a652942966c3ddd7ec57..62b91feb09d0b62926b0d9b20a7b90750d867b83 100644 (file)
@@ -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()
     };
 
index f0b16ccf97531ccc6a2274be6b483530a840f591..a8bcf720e396125afbb40940a2e616bb3af8c008 100644 (file)
@@ -410,13 +410,17 @@ fn rust_input<R, F>(cratefile: &str, externs: Externs, matches: &getopts::Matche
     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");