Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 683128 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/bootstrap/builder.rs (-5 / +6 lines)
Lines 677-685 impl<'a> Builder<'a> { Link Here
677
        let compiler = self.compiler(self.top_stage, host);
677
        let compiler = self.compiler(self.top_stage, host);
678
        cmd.env("RUSTC_STAGE", compiler.stage.to_string())
678
        cmd.env("RUSTC_STAGE", compiler.stage.to_string())
679
            .env("RUSTC_SYSROOT", self.sysroot(compiler))
679
            .env("RUSTC_SYSROOT", self.sysroot(compiler))
680
            // Note that this is *not* the sysroot_libdir because rustdoc must be linked
680
            .env(
681
            // equivalently to rustc.
681
                "RUSTDOC_LIBDIR",
682
            .env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler))
682
                self.sysroot_libdir(compiler, self.config.build),
683
            )
683
            .env("CFG_RELEASE_CHANNEL", &self.config.channel)
684
            .env("CFG_RELEASE_CHANNEL", &self.config.channel)
684
            .env("RUSTDOC_REAL", self.rustdoc(host))
685
            .env("RUSTDOC_REAL", self.rustdoc(host))
685
            .env("RUSTDOC_CRATE_VERSION", self.rust_version())
686
            .env("RUSTDOC_CRATE_VERSION", self.rust_version())
Lines 873-879 impl<'a> Builder<'a> { Link Here
873
        } else {
874
        } else {
874
            &maybe_sysroot
875
            &maybe_sysroot
875
        };
876
        };
876
        let libdir = self.rustc_libdir(compiler);
877
        let libdir = sysroot.join(libdir(&compiler.host));
877
878
878
        // Customize the compiler we're running. Specify the compiler to cargo
879
        // Customize the compiler we're running. Specify the compiler to cargo
879
        // as our shim and then pass it some various options used to configure
880
        // as our shim and then pass it some various options used to configure
Lines 915-921 impl<'a> Builder<'a> { Link Here
915
            cargo.env("RUSTC_ERROR_FORMAT", error_format);
916
            cargo.env("RUSTC_ERROR_FORMAT", error_format);
916
        }
917
        }
917
        if cmd != "build" && cmd != "check" && cmd != "rustc" && want_rustdoc {
918
        if cmd != "build" && cmd != "check" && cmd != "rustc" && want_rustdoc {
918
            cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));
919
            cargo.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build));
919
        }
920
        }
920
921
921
        if mode.is_tool() {
922
        if mode.is_tool() {
(-)a/src/bootstrap/tool.rs (-18 / +18 lines)
Lines 418-442 impl Step for Rustdoc { Link Here
418
418
419
    fn run(self, builder: &Builder<'_>) -> PathBuf {
419
    fn run(self, builder: &Builder<'_>) -> PathBuf {
420
        let target_compiler = builder.compiler(builder.top_stage, self.host);
420
        let target_compiler = builder.compiler(builder.top_stage, self.host);
421
        if target_compiler.stage == 0 {
422
            if !target_compiler.is_snapshot(builder) {
423
                panic!("rustdoc in stage 0 must be snapshot rustdoc");
424
            }
425
            return builder.initial_rustc.with_file_name(exe("rustdoc", &target_compiler.host));
426
        }
427
        let target = target_compiler.host;
421
        let target = target_compiler.host;
428
        // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
422
        let build_compiler = if target_compiler.stage == 0 {
429
        // we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
423
            builder.compiler(0, builder.config.build)
430
        // compilers, which isn't what we want. Rustdoc should be linked in the same way as the
424
        } else if target_compiler.stage >= 2 {
431
        // rustc compiler it's paired with, so it must be built with the previous stage compiler.
425
            // Past stage 2, we consider the compiler to be ABI-compatible and hence capable of
432
        let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build);
426
            // building rustdoc itself.
433
427
            builder.compiler(target_compiler.stage, builder.config.build)
434
        // The presence of `target_compiler` ensures that the necessary libraries (codegen backends,
428
        } else {
435
        // compiler libraries, ...) are built. Rustdoc does not require the presence of any
429
            // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise
436
        // libraries within sysroot_libdir (i.e., rustlib), though doctests may want it (since
430
            // we'd have stageN/bin/rustc and stageN/bin/rustdoc be effectively different stage
437
        // they'll be linked to those libraries). As such, don't explicitly `ensure` any additional
431
            // compilers, which isn't what we want.
438
        // libraries here. The intuition here is that If we've built a compiler, we should be able
432
            builder.compiler(target_compiler.stage - 1, builder.config.build)
439
        // to build rustdoc.
433
        };
434
435
        builder.ensure(compile::Rustc { compiler: build_compiler, target });
436
        builder.ensure(compile::Rustc {
437
            compiler: build_compiler,
438
            target: builder.config.build,
439
        });
440
440
441
        let mut cargo = prepare_tool_cargo(
441
        let mut cargo = prepare_tool_cargo(
442
            builder,
442
            builder,

Return to bug 683128