Change:
I tried this with Rust 1.66.0, simplified from my build for Fedora: I expected to see this happen: passing tests Instead, this happened: 20 failures, all of this sort: My stage0 should be using . It most recently worked on: Rust 1.65.0 : I bisected this to , commit , which stopped using and environment variables when building a . <details<summaryBacktrace</summary<p</p</details modify labels: +regression-from-stable-to-stable -regression-untriaged +A-bootstrap <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
FYI we had the same problem on Debian, worked around with a custom patch:

Discussion:
if env is None: env = {} <ins> # This test ends up invoking build_bootstrap_cmd, which searches for # the Cargo binary and errors out if it cannot be found. This is not a # problem in most cases, but there is a scenario where it would cause # the test to fail. # # When a custom local Cargo is configured in config.toml (with the # build.cargo setting), no Cargo is downloaded to any location known by # bootstrap, and bootstrap relies on that setting to find it. # # In this test though we are not using the config.toml of the caller: # we are generating a blank one instead. If we don't set build.cargo in # it, the test will have no way to find Cargo, failing the test. cargo_bin = os.environ.get("BOOTSTRAP_TEST_CARGO_BIN") if cargo_bin is not None: configure_args += ["--set", "build.cargo=" + cargo_bin] rustc_bin = os.environ.get("BOOTSTRAP_TEST_RUSTC_BIN") if rustc_bin is not None: configure_args += ["--set", "build.rustc=" + rustc_bin] </ins> env = env.copy() env["PATH"] = os.environ["PATH"]

.args(["-m", "unittest", "bootstrap_test.py"]) .env("BUILD_DIR", &builder.out) .env("BUILD_PLATFORM", builder.build.build.triple) <ins> .env("BOOTSTRAP_TEST_RUSTC_BIN", &builder.initial_rustc) .env("BOOTSTRAP_TEST_CARGO_BIN", &builder.initial_cargo) </ins> .current_dir(builder.src.join("src/bootstrap/")); // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible. // Use `python -m unittest` manually if you want to pass arguments.

TomlConfig::default() }; <ins> if cfg!(test) { // When configuring bootstrap for tests, make sure to set the rustc and Cargo to the // same ones used to call the tests (if custom ones are not defined in the toml). If we // don't do that, bootstrap will use its own detection logic to find a suitable rustc // and Cargo, which doesn't work when the caller is specìfying a custom local rustc or // Cargo in their config.toml. let build = toml.build.get_or_insert_with(Default::default); build.rustc = build.rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into())); build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into())); } </ins> if let Some(include) = &toml.profile { // Allows creating alias for profile names, allowing // profiles to be renamed while maintaining back compatibility

rustc } else { config.download_beta_toolchain(); <del> config.out.join(config.build.triple).join("stage0/bin/rustc") </del> <ins> config .out .join(config.build.triple) .join("stage0") .join("bin") .join(exe("rustc", config.build)) </ins> }; config.initial_cargo = if let Some(cargo) = cargo {

cargo } else { config.download_beta_toolchain(); <del> config.out.join(config.build.triple).join("stage0/bin/cargo") </del> <ins> config .out .join(config.build.triple) .join("stage0") .join("bin") .join(exe("cargo", config.build)) </ins> }; // NOTE: it's important this comes *after* we set `initial_rustc` just above.