Only write metadata module when necessary
This commit is contained in:
parent
805e270910
commit
847a37fedc
1 changed files with 7 additions and 5 deletions
|
@ -98,7 +98,7 @@ fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option<File>) ->
|
|||
fn run_aot<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
metadata: EncodedMetadata,
|
||||
_need_metadata_module: bool,
|
||||
need_metadata_module: bool,
|
||||
log: &mut Option<File>,
|
||||
) -> Box<CodegenResults> {
|
||||
let new_module = |name: String| {
|
||||
|
@ -166,7 +166,7 @@ fn run_aot<'a, 'tcx: 'a>(
|
|||
rustc_incremental::save_dep_graph(tcx);
|
||||
rustc_incremental::finalize_session_directory(tcx.sess, tcx.crate_hash(LOCAL_CRATE));
|
||||
|
||||
let metadata_module = {
|
||||
let metadata_module = if need_metadata_module {
|
||||
use rustc::mir::mono::CodegenUnitNameBuilder;
|
||||
|
||||
let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
|
||||
|
@ -186,13 +186,15 @@ fn run_aot<'a, 'tcx: 'a>(
|
|||
let obj = metadata_artifact.emit().unwrap();
|
||||
std::fs::write(&tmp_file, obj).unwrap();
|
||||
|
||||
CompiledModule {
|
||||
Some(CompiledModule {
|
||||
name: metadata_cgu_name,
|
||||
kind: ModuleKind::Metadata,
|
||||
object: Some(tmp_file),
|
||||
bytecode: None,
|
||||
bytecode_compressed: None,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Box::new(CodegenResults {
|
||||
|
@ -213,7 +215,7 @@ fn run_aot<'a, 'tcx: 'a>(
|
|||
} else {
|
||||
None
|
||||
},
|
||||
metadata_module: Some(metadata_module),
|
||||
metadata_module,
|
||||
crate_hash: tcx.crate_hash(LOCAL_CRATE),
|
||||
metadata,
|
||||
windows_subsystem: None, // Windows is not yet supported
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue