Auto merge of #83846 - torhovland:issue-10971, r=davidtwco
Added the --temps-dir option Fixes #10971. The new `--temps-dir` option puts intermediate files in a user-specified directory. This provides a fix for the issue where parallel invocations of rustc would overwrite each other's intermediate files. No files are kept in the intermediate directory unless `-C save-temps=yes`. If additional files are specifically requested using `--emit asm,llvm-bc,llvm-ir,obj,metadata,link,dep-info,mir`, these will be put in the output directory rather than the intermediate directory. This is a backward-compatible change, i.e. if `--temps-dir` is not specified, the behavior is the same as before.
This commit is contained in:
commit
9dbbbb12c0
9 changed files with 72 additions and 5 deletions
|
@ -692,6 +692,7 @@ pub fn prepare_outputs(
|
|||
&compiler.input,
|
||||
&compiler.output_dir,
|
||||
&compiler.output_file,
|
||||
&compiler.temps_dir,
|
||||
&krate.attrs,
|
||||
sess,
|
||||
);
|
||||
|
@ -722,6 +723,13 @@ pub fn prepare_outputs(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(ref dir) = compiler.temps_dir {
|
||||
if fs::create_dir_all(dir).is_err() {
|
||||
sess.err("failed to find or create the directory specified by `--temps-dir`");
|
||||
return Err(ErrorReported);
|
||||
}
|
||||
}
|
||||
|
||||
write_out_deps(sess, boxed_resolver, &outputs, &output_paths);
|
||||
|
||||
let only_dep_info = sess.opts.output_types.contains_key(&OutputType::DepInfo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue