rustbuild: Fix compiler docs yet again

Add support for `-Z force-unstable-if-unmarked` to rustdoc.
This commit is contained in:
Oliver Middleton 2017-06-21 17:59:10 +01:00
parent 445077963c
commit ae1dc2a6f9
3 changed files with 16 additions and 7 deletions

View File

@ -41,11 +41,11 @@ fn main() {
.env(bootstrap::util::dylib_path_var(), .env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap()); env::join_paths(&dylib_path).unwrap());
// Pass the `rustbuild` feature flag to crates which rustbuild is // Force all crates compiled by this compiler to (a) be unstable and (b)
// building. See the comment in bootstrap/lib.rs where this env var is // allow the `rustc_private` feature to link to other unstable crates
// set for more details. // also in the sysroot.
if env::var_os("RUSTBUILD_UNSTABLE").is_some() { if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
cmd.arg("--cfg").arg("rustbuild"); cmd.arg("-Z").arg("force-unstable-if-unmarked");
} }
std::process::exit(match cmd.status() { std::process::exit(match cmd.status() {

View File

@ -106,7 +106,8 @@ pub fn run_core(search_paths: SearchPaths,
input: Input, input: Input,
triple: Option<String>, triple: Option<String>,
maybe_sysroot: Option<PathBuf>, 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. // 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 // Ensure that rustdoc works even if rustc is feature-staged
unstable_features: UnstableFeatures::Allow, unstable_features: UnstableFeatures::Allow,
actually_rustdoc: true, actually_rustdoc: true,
debugging_opts: config::DebuggingOptions {
force_unstable_if_unmarked: force_unstable_if_unmarked,
..config::basic_debugging_options()
},
..config::basic_options().clone() ..config::basic_options().clone()
}; };

View File

@ -410,13 +410,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
info!("starting to run rustc"); info!("starting to run rustc");
let display_warnings = matches.opt_present("display-warnings"); 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(); let (tx, rx) = channel();
rustc_driver::monitor(move || { rustc_driver::monitor(move || {
use rustc::session::config::Input; use rustc::session::config::Input;
let (mut krate, renderinfo) = let (mut krate, renderinfo) =
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot, core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
display_warnings); display_warnings, force_unstable_if_unmarked);
info!("finished with rustc"); info!("finished with rustc");