diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 0d604c0d3e5e0..1aff8a1a8edf0 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -975,11 +975,15 @@ def build_bootstrap_cmd(self, env): if "RUSTFLAGS_BOOTSTRAP" in env: env["RUSTFLAGS"] += " " + env["RUSTFLAGS_BOOTSTRAP"] - env["PATH"] = os.path.join(self.bin_root(), "bin") + \ + cargo_bin_path = os.path.join(self.bin_root(), "bin") + \ os.pathsep + env["PATH"] if not os.path.isfile(self.cargo()): - raise Exception("no cargo executable found at `{}`".format( + if cargo_bin_path is None: + raise Exception("no cargo executable found at `{}`".format( self.cargo())) + else: + cargo_bin_path = os.getenv("RUST_TARGET_PATH") + "rust-snapshot/bin/cargo" + env["PATH"] = os.path.dirname(cargo_bin_path) + os.pathsep + env["PATH"] args = [self.cargo(), "build", "--manifest-path", os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")] args.extend("--verbose" for _ in range(self.verbose))