about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-25 11:31:33 +0100
committerGitHub <noreply@github.com>2023-02-25 11:31:33 +0100
commit91a8496b64675a0f3389b1827078a3c0389ebd89 (patch)
tree701548b2faaf83c73068e1f5d1672b5b2ed4ec7f
parent94a783524c1795c93a66348b4554c80120973962 (diff)
parent49516b3f5705c201a915c1b0c690d0f112da6c6a (diff)
downloadrust-91a8496b64675a0f3389b1827078a3c0389ebd89.tar.gz
rust-91a8496b64675a0f3389b1827078a3c0389ebd89.zip
Rollup merge of #108404 - ozkanonur:108004, r=jyn514
support `x fmt` for sub and outside of rust directories

This PR makes `x fmt` to be succesfully work from sub or outside dir of rust.

The following cases are tested and the results were successful.
```sh
# from rust/library directory
../x fmt compiler --check
../x fmt compiler/rustc

# from outside of rust directory
../../rust/x fmt library/std library/core --check
../../rust/x fmt library/std
```

Resolves #108004

r? ``@albertlarsan68``
-rw-r--r--src/bootstrap/format.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs
index 615794958d0..ae72a42973c 100644
--- a/src/bootstrap/format.rs
+++ b/src/bootstrap/format.rs
@@ -218,7 +218,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
                     WalkBuilder::new(first)
                 }
             } else {
-                WalkBuilder::new(first)
+                WalkBuilder::new(src.join(first))
             };
 
             for path in &paths[1..] {
@@ -229,7 +229,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
                         walker.add(path);
                     }
                 } else {
-                    walker.add(path);
+                    walker.add(src.join(path));
                 }
             }