about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-08-15 18:13:32 -0400
committerGitHub <noreply@github.com>2025-08-15 18:13:32 -0400
commit56e9a67d16f02a2a2889f91f88c98638982a42e3 (patch)
tree769b03a44a144239a181554eab026f7a0e93f984 /src/bootstrap
parent4fa90ef7996f891f7f1e126411e5d75afe64accf (diff)
parent24f5cc41c80a5ca22d5e6871aa71d1367bc15bf8 (diff)
downloadrust-56e9a67d16f02a2a2889f91f88c98638982a42e3.tar.gz
rust-56e9a67d16f02a2a2889f91f88c98638982a42e3.zip
Rollup merge of #145455 - Kobzol:bootstrap-copy-src-dirs-dry-run, r=jieyouxu
Do not copy files in `copy_src_dirs` in dry run

This reduces the time to run the current 9 dist snapshot tests from ~24s to ~2s on my PC.

r? `@jieyouxu`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 64c2cdd2ec7..414f4464d1e 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -916,6 +916,12 @@ fn copy_src_dirs(
     exclude_dirs: &[&str],
     dst_dir: &Path,
 ) {
+    // Iterating, filtering and copying a large number of directories can be quite slow.
+    // Avoid doing it in dry run (and thus also tests).
+    if builder.config.dry_run() {
+        return;
+    }
+
     fn filter_fn(exclude_dirs: &[&str], dir: &str, path: &Path) -> bool {
         let spath = match path.to_str() {
             Some(path) => path,