File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,7 @@ impl<'a> ArArchiveBuilder<'a> {
493493 perms : 0o644 ,
494494 } )
495495 }
496+
496497 // Write to a temporary file first before atomically renaming to the final name.
497498 // This prevents programs (including rustc) from attempting to read a partial archive.
498499 // It also enables writing an archive with the same filename as a dependency on Windows as
@@ -510,6 +511,7 @@ impl<'a> ArArchiveBuilder<'a> {
510511 let archive_tmpfile_path = archive_tmpdir. path ( ) . join ( "tmp.a" ) ;
511512 let archive_tmpfile = File :: create_new ( & archive_tmpfile_path)
512513 . map_err ( |err| io_error_context ( "couldn't create the temp file" , err) ) ?;
514+
513515 let mut archive_tmpfile = BufWriter :: new ( archive_tmpfile) ;
514516 write_archive_to_stream (
515517 & mut archive_tmpfile,
@@ -520,6 +522,7 @@ impl<'a> ArArchiveBuilder<'a> {
520522 ) ?;
521523 archive_tmpfile. flush ( ) ?;
522524 drop ( archive_tmpfile) ;
525+
523526 let any_entries = !entries. is_empty ( ) ;
524527 drop ( entries) ;
525528 // Drop src_archives to unmap all input archives, which is necessary if we want to write the
You can’t perform that action at this time.
0 commit comments