diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 0a79d09b27f..01c4ef4f5ae 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1316,8 +1316,8 @@ fn run(self, builder: &Builder<'_>) { tarballs.push(mingw_installer.unwrap()); } - let mut tarball = Tarball::new(builder, "rust", &target.triple); - let work = tarball.persist_work_dir(); + let tarball = Tarball::new(builder, "rust", &target.triple); + let work = tarball.work_dir(); tarball.combine(&tarballs); let tmp = tmpdir(builder).join("combined-tarball"); diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 137370fe6cb..91302dc3cfd 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -97,7 +97,6 @@ pub(crate) struct Tarball<'a> { include_target_in_component_name: bool, is_preview: bool, - delete_temp_dir: bool, } impl<'a> Tarball<'a> { @@ -136,7 +135,6 @@ fn new_inner(builder: &'a Builder<'a>, component: &str, target: Option) include_target_in_component_name: false, is_preview: false, - delete_temp_dir: true, } } @@ -198,8 +196,7 @@ pub(crate) fn add_dir(&self, src: impl AsRef, dest: impl AsRef) { self.builder.cp_r(src.as_ref(), &dest); } - pub(crate) fn persist_work_dir(&mut self) -> PathBuf { - self.delete_temp_dir = false; + pub(crate) fn work_dir(&self) -> PathBuf { self.temp_dir.clone() } @@ -299,9 +296,6 @@ fn run(self, build_cli: impl FnOnce(&Tarball<'a>, &mut Command)) -> PathBuf { cmd.arg("--compression-formats").arg(formats.join(",")); } self.builder.run(&mut cmd); - if self.delete_temp_dir { - t!(std::fs::remove_dir_all(&self.temp_dir)); - } // Use either the first compression format defined, or "gz" as the default. let ext = self