Skip to content

Commit 6e0f1cc

Browse files
committed
Auto merge of #53962 - michaelwoerister:close-thinlto-file-descriptors, r=alexcrichton
ThinLTO: Don't keep files open after mmaping them. Fixes #53947. r? @alexcrichton
2 parents 780b0c7 + fc47a92 commit 6e0f1cc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc_codegen_llvm/back/lto.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use {ModuleCodegen, ModuleLlvm, ModuleKind};
2929
use libc;
3030

3131
use std::ffi::{CStr, CString};
32-
use std::fs::{self, File};
32+
use std::fs;
3333
use std::ptr;
3434
use std::slice;
3535
use std::sync::Arc;
@@ -619,15 +619,15 @@ fn run_pass_manager(cgcx: &CodegenContext,
619619
pub enum SerializedModule {
620620
Local(ModuleBuffer),
621621
FromRlib(Vec<u8>),
622-
FromUncompressedFile(memmap::Mmap, File),
622+
FromUncompressedFile(memmap::Mmap),
623623
}
624624

625625
impl SerializedModule {
626626
fn data(&self) -> &[u8] {
627627
match *self {
628628
SerializedModule::Local(ref m) => m.data(),
629629
SerializedModule::FromRlib(ref m) => m,
630-
SerializedModule::FromUncompressedFile(ref m, _) => m,
630+
SerializedModule::FromUncompressedFile(ref m) => m,
631631
}
632632
}
633633
}

src/librustc_codegen_llvm/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ pub(crate) fn submit_pre_lto_module_to_llvm(tcx: TyCtxt,
24942494

24952495
// Schedule the module to be loaded
24962496
drop(tcx.tx_to_llvm_workers.lock().send(Box::new(Message::AddImportOnlyModule {
2497-
module_data: SerializedModule::FromUncompressedFile(mmap, file),
2497+
module_data: SerializedModule::FromUncompressedFile(mmap),
24982498
work_product: module.source,
24992499
})));
25002500
}

0 commit comments

Comments
 (0)