Skip to content

Commit 5ef2683

Browse files
authored
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
2 parents d549ae0 + ae1dc2a commit 5ef2683

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/bootstrap/bin/rustdoc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ fn main() {
4141
.env(bootstrap::util::dylib_path_var(),
4242
env::join_paths(&dylib_path).unwrap());
4343

44-
// Pass the `rustbuild` feature flag to crates which rustbuild is
45-
// building. See the comment in bootstrap/lib.rs where this env var is
46-
// set for more details.
47-
if env::var_os("RUSTBUILD_UNSTABLE").is_some() {
48-
cmd.arg("--cfg").arg("rustbuild");
44+
// Force all crates compiled by this compiler to (a) be unstable and (b)
45+
// allow the `rustc_private` feature to link to other unstable crates
46+
// also in the sysroot.
47+
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
48+
cmd.arg("-Z").arg("force-unstable-if-unmarked");
4949
}
5050

5151
std::process::exit(match cmd.status() {

src/librustdoc/core.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ pub fn run_core(search_paths: SearchPaths,
106106
input: Input,
107107
triple: Option<String>,
108108
maybe_sysroot: Option<PathBuf>,
109-
allow_warnings: bool) -> (clean::Crate, RenderInfo)
109+
allow_warnings: bool,
110+
force_unstable_if_unmarked: bool) -> (clean::Crate, RenderInfo)
110111
{
111112
// Parse, resolve, and typecheck the given crate.
112113

@@ -128,6 +129,10 @@ pub fn run_core(search_paths: SearchPaths,
128129
// Ensure that rustdoc works even if rustc is feature-staged
129130
unstable_features: UnstableFeatures::Allow,
130131
actually_rustdoc: true,
132+
debugging_opts: config::DebuggingOptions {
133+
force_unstable_if_unmarked: force_unstable_if_unmarked,
134+
..config::basic_debugging_options()
135+
},
131136
..config::basic_options().clone()
132137
};
133138

src/librustdoc/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -465,13 +465,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
465465
info!("starting to run rustc");
466466
let display_warnings = matches.opt_present("display-warnings");
467467

468+
let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| {
469+
*x == "force-unstable-if-unmarked"
470+
});
471+
468472
let (tx, rx) = channel();
469473
rustc_driver::monitor(move || {
470474
use rustc::session::config::Input;
471475

472476
let (mut krate, renderinfo) =
473477
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
474-
display_warnings);
478+
display_warnings, force_unstable_if_unmarked);
475479

476480
info!("finished with rustc");
477481

0 commit comments

Comments
 (0)