Skip to content

Commit 6cf081c

Browse files
committed
Auto merge of #46592 - o01eg:fix-45345, r=alexcrichton
Fix 45345 There is a fix for #45345 It re-introduces `CFG_LIBDIR_RELATIVE` which was broken when migration from `configure` script to `x.py`. Other commits fix errors which happen after rustbuild cleanups.
2 parents 6eff103 + 472f4e1 commit 6cf081c

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

src/bootstrap/bin/rustdoc.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ use std::path::PathBuf;
2323
fn main() {
2424
let args = env::args_os().skip(1).collect::<Vec<_>>();
2525
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
26-
let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
26+
let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set");
2727
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
2828
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
2929

30+
use std::str::FromStr;
31+
32+
let verbose = match env::var("RUSTC_VERBOSE") {
33+
Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"),
34+
Err(_) => 0,
35+
};
36+
3037
let mut dylib_path = bootstrap::util::dylib_path();
3138
dylib_path.insert(0, PathBuf::from(libdir));
3239

@@ -63,6 +70,10 @@ fn main() {
6370
cmd.arg("--deny-render-differences");
6471
}
6572

73+
if verbose > 1 {
74+
eprintln!("rustdoc command: {:?}", cmd);
75+
}
76+
6677
std::process::exit(match cmd.status() {
6778
Ok(s) => s.code().unwrap_or(1),
6879
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),

src/bootstrap/builder.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ impl<'a> Builder<'a> {
357357

358358
fn run(self, builder: &Builder) -> Interned<PathBuf> {
359359
let compiler = self.compiler;
360-
let lib = if compiler.stage >= 2 && builder.build.config.libdir_relative.is_some() {
361-
builder.build.config.libdir_relative.clone().unwrap()
360+
let lib = if compiler.stage >= 1 && builder.build.config.libdir.is_some() {
361+
builder.build.config.libdir.clone().unwrap()
362362
} else {
363363
PathBuf::from("lib")
364364
};
@@ -416,7 +416,7 @@ impl<'a> Builder<'a> {
416416
let compiler = self.compiler(self.top_stage, host);
417417
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
418418
.env("RUSTC_SYSROOT", self.sysroot(compiler))
419-
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
419+
.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
420420
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
421421
.env("RUSTDOC_REAL", self.rustdoc(host))
422422
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
@@ -496,6 +496,9 @@ impl<'a> Builder<'a> {
496496
if let Some(target_linker) = self.build.linker(target) {
497497
cargo.env("RUSTC_TARGET_LINKER", target_linker);
498498
}
499+
if cmd != "build" {
500+
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
501+
}
499502

500503
if mode != Mode::Tool {
501504
// Tools don't get debuginfo right now, e.g. cargo and rls don't

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ impl Step for Crate {
11661166
}
11671167
Mode::Librustc => {
11681168
builder.ensure(compile::Rustc { compiler, target });
1169-
compile::rustc_cargo(build, &compiler, target, &mut cargo);
1169+
compile::rustc_cargo(build, target, &mut cargo);
11701170
("librustc", "rustc-main")
11711171
}
11721172
_ => panic!("can only test libraries"),

src/bootstrap/compile.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl Step for Rustc {
485485
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
486486

487487
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
488-
rustc_cargo(build, &compiler, target, &mut cargo);
488+
rustc_cargo(build, target, &mut cargo);
489489
run_cargo(build,
490490
&mut cargo,
491491
&librustc_stamp(build, compiler, target));
@@ -500,7 +500,6 @@ impl Step for Rustc {
500500

501501
/// Same as `std_cargo`, but for libtest
502502
pub fn rustc_cargo(build: &Build,
503-
compiler: &Compiler,
504503
target: Interned<String>,
505504
cargo: &mut Command) {
506505
cargo.arg("--features").arg(build.rustc_features())
@@ -514,13 +513,9 @@ pub fn rustc_cargo(build: &Build,
514513
.env("CFG_VERSION", build.rust_version())
515514
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default());
516515

517-
if compiler.stage == 0 {
518-
cargo.env("CFG_LIBDIR_RELATIVE", "lib");
519-
} else {
520-
let libdir_relative =
521-
build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib"));
522-
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
523-
}
516+
let libdir_relative =
517+
build.config.libdir.clone().unwrap_or(PathBuf::from("lib"));
518+
cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative);
524519

525520
// If we're not building a compiler with debugging information then remove
526521
// these two env vars which would be set otherwise.

src/bootstrap/config.rs

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ pub struct Config {
121121
pub docdir: Option<PathBuf>,
122122
pub bindir: Option<PathBuf>,
123123
pub libdir: Option<PathBuf>,
124-
pub libdir_relative: Option<PathBuf>,
125124
pub mandir: Option<PathBuf>,
126125
pub codegen_tests: bool,
127126
pub nodejs: Option<PathBuf>,

src/bootstrap/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl Step for Rustc {
616616
t!(symlink_dir_force(&my_out, &out_dir));
617617

618618
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc");
619-
compile::rustc_cargo(build, &compiler, target, &mut cargo);
619+
compile::rustc_cargo(build, target, &mut cargo);
620620

621621
if build.config.compiler_docs {
622622
// src/rustc/Cargo.toml contains a bin crate called rustc which

0 commit comments

Comments
 (0)