Skip to content

Commit ae1dc2a

Browse files
committed
rustbuild: Fix compiler docs yet again
Add support for `-Z force-unstable-if-unmarked` to rustdoc.
1 parent 4450779 commit ae1dc2a

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
@@ -410,13 +410,17 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
410410
info!("starting to run rustc");
411411
let display_warnings = matches.opt_present("display-warnings");
412412

413+
let force_unstable_if_unmarked = matches.opt_strs("Z").iter().any(|x| {
414+
*x == "force-unstable-if-unmarked"
415+
});
416+
413417
let (tx, rx) = channel();
414418
rustc_driver::monitor(move || {
415419
use rustc::session::config::Input;
416420

417421
let (mut krate, renderinfo) =
418422
core::run_core(paths, cfgs, externs, Input::File(cr), triple, maybe_sysroot,
419-
display_warnings);
423+
display_warnings, force_unstable_if_unmarked);
420424

421425
info!("finished with rustc");
422426

0 commit comments

Comments
 (0)