Skip to content

Commit a99838a

Browse files
committed
Make sure all input archives are unmapped before persisting the output archive
1 parent e1edc13 commit a99838a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_codegen_ssa/src/back/archive.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,17 @@ impl<'a> ArArchiveBuilder<'a> {
290290
false,
291291
)?;
292292

293+
let any_entries = !entries.is_empty();
294+
drop(entries);
295+
// Drop src_archives to unmap all input archives, which is necessary if we want to write the
296+
// output archive to the same location as an input archive on Windows.
297+
drop(self.src_archives);
298+
293299
archive_tmpfile
294300
.persist(output)
295301
.map_err(|err| io_error_context("failed to rename archive file", err.error))?;
296302

297-
Ok(!entries.is_empty())
303+
Ok(any_entries)
298304
}
299305
}
300306

0 commit comments

Comments
 (0)