Skip to content

Commit

Permalink
Make sure all input archives are unmapped before persisting the outpu…
Browse files Browse the repository at this point in the history
…t archive
  • Loading branch information
bjorn3 committed Dec 3, 2022
1 parent e1edc13 commit a99838a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/archive.rs
Expand Up @@ -290,11 +290,17 @@ impl<'a> ArArchiveBuilder<'a> {
false,
)?;

let any_entries = !entries.is_empty();
drop(entries);
// Drop src_archives to unmap all input archives, which is necessary if we want to write the
// output archive to the same location as an input archive on Windows.
drop(self.src_archives);

archive_tmpfile
.persist(output)
.map_err(|err| io_error_context("failed to rename archive file", err.error))?;

Ok(!entries.is_empty())
Ok(any_entries)
}
}

Expand Down

0 comments on commit a99838a

Please sign in to comment.