about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-09-14 21:54:16 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-09-14 22:02:13 -0500
commit63b8d9b6898ec926f9eafa372506b6722d583694 (patch)
tree1c4957d873abd342a7f6a995be81d982018c8510 /src/bootstrap
parent88a192257ce110e7fb1732aa2b65e481f811db7a (diff)
downloadrust-63b8d9b6898ec926f9eafa372506b6722d583694.tar.gz
rust-63b8d9b6898ec926f9eafa372506b6722d583694.zip
Allow using vendoring when running bootstrap from outside the current working directory
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py3
-rw-r--r--src/bootstrap/builder.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index cc08ae5f99f..25037bd0faa 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -771,7 +771,8 @@ class RustBuild(object):
         elif color == "never":
             args.append("--color=never")
 
-        run(args, env=env, verbose=self.verbose)
+        # Run this from the source directory so cargo finds .cargo/config
+        run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
 
     def build_triple(self):
         """Build triple as in LLVM
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 14e8ebd6876..6a07ac6b007 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1325,6 +1325,9 @@ impl<'a> Builder<'a> {
     ) -> Cargo {
         let mut cargo = Command::new(&self.initial_cargo);
         let out_dir = self.stage_out(compiler, mode);
+        // Run cargo from the source root so it can find .cargo/config.
+        // This matters when using vendoring and the working directory is outside the repository.
+        cargo.current_dir(&self.src);
 
         // Codegen backends are not yet tracked by -Zbinary-dep-depinfo,
         // so we need to explicitly clear out if they've been updated.