From 5d1e09f44ab0bd3ca29acf44d92e884ec140d00a Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Tue, 2 Nov 2021 22:41:34 +0100 Subject: [PATCH 01/10] Added the --temps-dir option. --- compiler/rustc_driver/src/lib.rs | 12 +++++++++++- compiler/rustc_interface/src/interface.rs | 15 ++++++++++++++- compiler/rustc_interface/src/passes.rs | 7 +++++++ compiler/rustc_interface/src/util.rs | 3 +++ compiler/rustc_session/src/config.rs | 14 ++++++++++++-- src/librustdoc/core.rs | 1 + src/librustdoc/doctest.rs | 1 + 7 files changed, 49 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 9a57ec99144..6b3c65dd527 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -215,6 +215,7 @@ fn run_compiler( let cfg = interface::parse_cfgspecs(matches.opt_strs("cfg")); let (odir, ofile) = make_output(&matches); + let temps_dir = make_temps_dir(&matches); let mut config = interface::Config { opts: sopts, crate_cfg: cfg, @@ -222,6 +223,7 @@ fn run_compiler( input_path: None, output_file: ofile, output_dir: odir, + temps_dir, file_loader, diagnostic_output, stderr: None, @@ -267,6 +269,7 @@ fn run_compiler( None, compiler.output_dir(), compiler.output_file(), + compiler.temps_dir(), ); if should_stop == Compilation::Stop { @@ -295,6 +298,7 @@ fn run_compiler( Some(compiler.input()), compiler.output_dir(), compiler.output_file(), + compiler.temps_dir(), ) .and_then(|| { RustcDefaultCalls::list_metadata( @@ -454,6 +458,11 @@ fn make_output(matches: &getopts::Matches) -> (Option, Option) (odir, ofile) } +// Extract temporary directory from matches. +fn make_temps_dir(matches: &getopts::Matches) -> Option { + matches.opt_str("temps-dir").map(|o| PathBuf::from(&o)) +} + // Extract input (string or file and optional path) from matches. fn make_input( error_format: ErrorOutputType, @@ -647,6 +656,7 @@ impl RustcDefaultCalls { input: Option<&Input>, odir: &Option, ofile: &Option, + temps_dir: &Option, ) -> Compilation { use rustc_session::config::PrintRequest::*; // PrintRequest::NativeStaticLibs is special - printed during linking @@ -685,7 +695,7 @@ impl RustcDefaultCalls { }); let attrs = attrs.as_ref().unwrap(); let t_outputs = rustc_interface::util::build_output_filenames( - input, odir, ofile, attrs, sess, + input, odir, ofile, temps_dir, attrs, sess, ); let id = rustc_session::output::find_crate_name(sess, attrs, input); if *req == PrintRequest::CrateName { diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 7a6a643e3d0..7b235be48b3 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -36,6 +36,7 @@ pub struct Compiler { pub(crate) input_path: Option, pub(crate) output_dir: Option, pub(crate) output_file: Option, + pub(crate) temps_dir: Option, pub(crate) register_lints: Option>, pub(crate) override_queries: Option, @@ -57,6 +58,9 @@ impl Compiler { pub fn output_file(&self) -> &Option { &self.output_file } + pub fn temps_dir(&self) -> &Option { + &self.temps_dir + } pub fn register_lints(&self) -> &Option> { &self.register_lints } @@ -65,7 +69,14 @@ impl Compiler { sess: &Session, attrs: &[ast::Attribute], ) -> OutputFilenames { - util::build_output_filenames(&self.input, &self.output_dir, &self.output_file, attrs, sess) + util::build_output_filenames( + &self.input, + &self.output_dir, + &self.output_file, + &self.temps_dir, + attrs, + sess, + ) } } @@ -132,6 +143,7 @@ pub struct Config { pub input_path: Option, pub output_dir: Option, pub output_file: Option, + pub temps_dir: Option, pub file_loader: Option>, pub diagnostic_output: DiagnosticOutput, @@ -193,6 +205,7 @@ pub fn create_compiler_and_run(config: Config, f: impl FnOnce(&Compiler) -> R input_path: config.input_path, output_dir: config.output_dir, output_file: config.output_file, + temps_dir: config.temps_dir, register_lints: config.register_lints, override_queries: config.override_queries, }; diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 62f5f09aa48..b14b1c4f1e6 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -692,6 +692,7 @@ pub fn prepare_outputs( &compiler.input, &compiler.output_dir, &compiler.output_file, + &compiler.temps_dir, &krate.attrs, sess, ); @@ -734,6 +735,12 @@ pub fn prepare_outputs( return Err(ErrorReported); } } + 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); + } + } } Ok(outputs) diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index cffb087af18..b446422f62f 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -604,6 +604,7 @@ pub fn build_output_filenames( input: &Input, odir: &Option, ofile: &Option, + temps_dir: &Option, attrs: &[ast::Attribute], sess: &Session, ) -> OutputFilenames { @@ -626,6 +627,7 @@ pub fn build_output_filenames( dirpath, stem, None, + temps_dir.clone(), sess.opts.cg.extra_filename.clone(), sess.opts.output_types.clone(), ) @@ -654,6 +656,7 @@ pub fn build_output_filenames( out_file.parent().unwrap_or_else(|| Path::new("")).to_path_buf(), out_file.file_stem().unwrap_or_default().to_str().unwrap().to_string(), ofile, + temps_dir.clone(), sess.opts.cg.extra_filename.clone(), sess.opts.output_types.clone(), ) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 299dfed9d5d..52cd8638b00 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -578,6 +578,7 @@ pub struct OutputFilenames { pub out_directory: PathBuf, filestem: String, pub single_output_file: Option, + pub temps_directory: Option, pub outputs: OutputTypes, } @@ -592,12 +593,14 @@ impl OutputFilenames { out_directory: PathBuf, out_filestem: String, single_output_file: Option, + temps_directory: Option, extra: String, outputs: OutputTypes, ) -> Self { OutputFilenames { out_directory, single_output_file, + temps_directory, outputs, filestem: format!("{}{}", out_filestem, extra), } @@ -643,11 +646,17 @@ impl OutputFilenames { extension.push_str(ext); } - self.with_extension(&extension) + let temps_directory = self.temps_directory.as_ref().unwrap_or(&self.out_directory); + + self.with_directory_and_extension(&temps_directory, &extension) } pub fn with_extension(&self, extension: &str) -> PathBuf { - let mut path = self.out_directory.join(&self.filestem); + self.with_directory_and_extension(&self.out_directory, extension) + } + + fn with_directory_and_extension(&self, directory: &PathBuf, extension: &str) -> PathBuf { + let mut path = directory.join(&self.filestem); path.set_extension(extension); path } @@ -1094,6 +1103,7 @@ pub fn rustc_short_optgroups() -> Vec { in ", "DIR", ), + opt::opt_s("", "temps-dir", "Write temporary output files to ", "DIR"), opt::opt_s( "", "explain", diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index b7251e8f571..063c0bc20c6 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -259,6 +259,7 @@ crate fn create_config( input_path: cpath, output_file: None, output_dir: None, + temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 9b32ad979e3..63eaded0320 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -94,6 +94,7 @@ crate fn run(options: Options) -> Result<(), ErrorReported> { input_path: None, output_file: None, output_dir: None, + temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, From bde794dadabd294b8a8a8a9157dbc52d0d469c15 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 4 Apr 2021 13:33:33 +0200 Subject: [PATCH 02/10] Create temps_dir before it's needed. --- compiler/rustc_interface/src/passes.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index b14b1c4f1e6..e0b0a2195f5 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -723,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) @@ -735,12 +742,6 @@ pub fn prepare_outputs( return Err(ErrorReported); } } - 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); - } - } } Ok(outputs) From 0132adc176c193fe9a1319a2a754306f2d438500 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 4 Apr 2021 13:35:04 +0200 Subject: [PATCH 03/10] Emitted files go to the output dir. --- compiler/rustc_session/src/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 52cd8638b00..034aebe42c1 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -611,7 +611,14 @@ impl OutputFilenames { .get(&flavor) .and_then(|p| p.to_owned()) .or_else(|| self.single_output_file.clone()) - .unwrap_or_else(|| self.temp_path(flavor, None)) + .unwrap_or_else(|| self.output_path(flavor)) + } + + /// Gets the output path where a compilation artifact of the given type + /// should be placed on disk. + pub fn output_path(&self, flavor: OutputType) -> PathBuf { + let extension = flavor.extension(); + self.with_directory_and_extension(&self.out_directory, &extension) } /// Gets the path where a compilation artifact of the given type for the From ac4f04bd82f019778b6b2c678f300f62a36024c3 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 4 Apr 2021 14:48:07 +0200 Subject: [PATCH 04/10] Documentation. --- src/doc/rustc/src/command-line-arguments.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 7f482f0f2b1..2d8aa3a4933 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -194,6 +194,15 @@ This flag controls the output filename. The outputted crate will be written to this directory. This flag is ignored if the [`-o` flag](#option-o-output) is used. + +## `--temps-dir`: directory to write the intermediate files in + +Intermediate files will be written to this directory. If not set, the output +directory is used. This option is useful if you are running more than one +instance of `rustc` (e.g. with different `--crate-type` settings), and you +need to make sure they are not overwriting each other's intermediate files. +No files are kept unless `-C save-temps=yes` is also set. + ## `--explain`: provide a detailed explanation of an error message From 0b378f008b9dd75ecadeede1ea0c963549f2933a Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 4 Apr 2021 15:24:17 +0200 Subject: [PATCH 05/10] Fix test. --- src/test/run-make-fulldeps/issue-19371/foo.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index 4acabbb70ed..626f74a342e 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -53,6 +53,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { input_path: None, output_file: Some(output), output_dir: None, + temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, From d4bcee9638cf8fdf7e9297438e70e20b212c6535 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 4 Apr 2021 15:54:21 +0200 Subject: [PATCH 06/10] Added a regression test. --- src/test/run-make/issue-10971-temps-dir/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/test/run-make/issue-10971-temps-dir/Makefile diff --git a/src/test/run-make/issue-10971-temps-dir/Makefile b/src/test/run-make/issue-10971-temps-dir/Makefile new file mode 100644 index 00000000000..d6b35cbfafd --- /dev/null +++ b/src/test/run-make/issue-10971-temps-dir/Makefile @@ -0,0 +1,10 @@ +include ../../run-make-fulldeps/tools.mk + +# Regression test for issue #10971 +# Running two invocations in parallel would overwrite each other's temp files. + +all: + touch $(TMPDIR)/lib.rs + + $(RUSTC) --crate-type=lib --temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \ + $(RUSTC) --crate-type=cdylib --temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs From ede76c40d1f1d32e6e1536b1e08122debc52ab00 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 7 Nov 2021 00:14:54 +0100 Subject: [PATCH 07/10] Made temps-dir an unstable option. --- compiler/rustc_driver/src/lib.rs | 7 ------- compiler/rustc_interface/src/interface.rs | 5 +++-- compiler/rustc_interface/src/tests.rs | 1 + compiler/rustc_session/src/config.rs | 1 - compiler/rustc_session/src/options.rs | 2 ++ src/doc/rustc/src/command-line-arguments.md | 9 --------- src/doc/unstable-book/src/compiler-flags/temps-dir.md | 10 ++++++++++ src/librustdoc/core.rs | 1 - src/librustdoc/doctest.rs | 1 - src/test/run-make-fulldeps/issue-19371/foo.rs | 1 - src/test/run-make/issue-10971-temps-dir/Makefile | 4 ++-- 11 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 src/doc/unstable-book/src/compiler-flags/temps-dir.md diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 6b3c65dd527..09fe3a552a0 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -215,7 +215,6 @@ fn run_compiler( let cfg = interface::parse_cfgspecs(matches.opt_strs("cfg")); let (odir, ofile) = make_output(&matches); - let temps_dir = make_temps_dir(&matches); let mut config = interface::Config { opts: sopts, crate_cfg: cfg, @@ -223,7 +222,6 @@ fn run_compiler( input_path: None, output_file: ofile, output_dir: odir, - temps_dir, file_loader, diagnostic_output, stderr: None, @@ -458,11 +456,6 @@ fn make_output(matches: &getopts::Matches) -> (Option, Option) (odir, ofile) } -// Extract temporary directory from matches. -fn make_temps_dir(matches: &getopts::Matches) -> Option { - matches.opt_str("temps-dir").map(|o| PathBuf::from(&o)) -} - // Extract input (string or file and optional path) from matches. fn make_input( error_format: ErrorOutputType, diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 7b235be48b3..2904b3f5b70 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -143,7 +143,6 @@ pub struct Config { pub input_path: Option, pub output_dir: Option, pub output_file: Option, - pub temps_dir: Option, pub file_loader: Option>, pub diagnostic_output: DiagnosticOutput, @@ -198,6 +197,8 @@ pub fn create_compiler_and_run(config: Config, f: impl FnOnce(&Compiler) -> R ); } + let temps_dir = sess.opts.debugging_opts.temps_dir.as_ref().map(|o| PathBuf::from(&o)); + let compiler = Compiler { sess, codegen_backend, @@ -205,7 +206,7 @@ pub fn create_compiler_and_run(config: Config, f: impl FnOnce(&Compiler) -> R input_path: config.input_path, output_dir: config.output_dir, output_file: config.output_file, - temps_dir: config.temps_dir, + temps_dir, register_lints: config.register_lints, override_queries: config.override_queries, }; diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 2d3cb52f5fd..eed2e07e890 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -685,6 +685,7 @@ fn test_debugging_options_tracking_hash() { untracked!(span_debug, true); untracked!(span_free_formats, true); untracked!(strip, Strip::Debuginfo); + untracked!(temps_dir, Some(String::from("abc"))); untracked!(terminal_width, Some(80)); untracked!(threads, 99); untracked!(time, true); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 034aebe42c1..fe8a26a700e 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1110,7 +1110,6 @@ pub fn rustc_short_optgroups() -> Vec { in ", "DIR", ), - opt::opt_s("", "temps-dir", "Write temporary output files to ", "DIR"), opt::opt_s( "", "explain", diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index e894e46a301..77a993a28ca 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1331,6 +1331,8 @@ options! { "which mangling version to use for symbol names ('legacy' (default) or 'v0')"), teach: bool = (false, parse_bool, [TRACKED], "show extended diagnostic help (default: no)"), + temps_dir: Option = (None, parse_opt_string, [UNTRACKED], + "the directory the intermediate files are written to"), terminal_width: Option = (None, parse_opt_number, [UNTRACKED], "set the current terminal width"), tune_cpu: Option = (None, parse_opt_string, [TRACKED], diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 2d8aa3a4933..7f482f0f2b1 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -194,15 +194,6 @@ This flag controls the output filename. The outputted crate will be written to this directory. This flag is ignored if the [`-o` flag](#option-o-output) is used. - -## `--temps-dir`: directory to write the intermediate files in - -Intermediate files will be written to this directory. If not set, the output -directory is used. This option is useful if you are running more than one -instance of `rustc` (e.g. with different `--crate-type` settings), and you -need to make sure they are not overwriting each other's intermediate files. -No files are kept unless `-C save-temps=yes` is also set. - ## `--explain`: provide a detailed explanation of an error message diff --git a/src/doc/unstable-book/src/compiler-flags/temps-dir.md b/src/doc/unstable-book/src/compiler-flags/temps-dir.md new file mode 100644 index 00000000000..e25011f7119 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/temps-dir.md @@ -0,0 +1,10 @@ +# `temps-dir` + +-------------------- + +The `-Ztemps-dir` compiler flag specifies the directory to write the +intermediate files in. If not set, the output directory is used. This option is +useful if you are running more than one instance of `rustc` (e.g. with different +`--crate-type` settings), and you need to make sure they are not overwriting +each other's intermediate files. No files are kept unless `-C save-temps=yes` is +also set. diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 063c0bc20c6..b7251e8f571 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -259,7 +259,6 @@ crate fn create_config( input_path: cpath, output_file: None, output_dir: None, - temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 63eaded0320..9b32ad979e3 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -94,7 +94,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> { input_path: None, output_file: None, output_dir: None, - temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index 626f74a342e..4acabbb70ed 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -53,7 +53,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { input_path: None, output_file: Some(output), output_dir: None, - temps_dir: None, file_loader: None, diagnostic_output: DiagnosticOutput::Default, stderr: None, diff --git a/src/test/run-make/issue-10971-temps-dir/Makefile b/src/test/run-make/issue-10971-temps-dir/Makefile index d6b35cbfafd..28aa188c392 100644 --- a/src/test/run-make/issue-10971-temps-dir/Makefile +++ b/src/test/run-make/issue-10971-temps-dir/Makefile @@ -6,5 +6,5 @@ include ../../run-make-fulldeps/tools.mk all: touch $(TMPDIR)/lib.rs - $(RUSTC) --crate-type=lib --temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \ - $(RUSTC) --crate-type=cdylib --temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs + $(RUSTC) --crate-type=lib -Z temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \ + $(RUSTC) --crate-type=cdylib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs From 27464fa5016bf5cfcc7e6cab3801003b1c7d21d4 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 7 Nov 2021 20:06:22 +0100 Subject: [PATCH 08/10] Almost all the other tests use '-include', so we'll do too. --- src/test/run-make/issue-10971-temps-dir/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/run-make/issue-10971-temps-dir/Makefile b/src/test/run-make/issue-10971-temps-dir/Makefile index 28aa188c392..18d8729ab0c 100644 --- a/src/test/run-make/issue-10971-temps-dir/Makefile +++ b/src/test/run-make/issue-10971-temps-dir/Makefile @@ -1,4 +1,4 @@ -include ../../run-make-fulldeps/tools.mk +-include ../../run-make-fulldeps/tools.mk # Regression test for issue #10971 # Running two invocations in parallel would overwrite each other's temp files. From 13dbdc6ad30a6584f02c723ce3f7447237c97b17 Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Sun, 7 Nov 2021 20:08:42 +0100 Subject: [PATCH 09/10] There is a -Clinker='arm-none-eabi-gcc' that seems to be causing trouble. --- src/test/run-make/issue-10971-temps-dir/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/run-make/issue-10971-temps-dir/Makefile b/src/test/run-make/issue-10971-temps-dir/Makefile index 18d8729ab0c..f062e652a04 100644 --- a/src/test/run-make/issue-10971-temps-dir/Makefile +++ b/src/test/run-make/issue-10971-temps-dir/Makefile @@ -3,6 +3,9 @@ # Regression test for issue #10971 # Running two invocations in parallel would overwrite each other's temp files. +## clean up unused env variables which might cause harm. +unexport RUSTC_LINKER + all: touch $(TMPDIR)/lib.rs From 1793a7acc74f5581febf5822923f8f38c63e8f2a Mon Sep 17 00:00:00 2001 From: Tor Hovland Date: Wed, 10 Nov 2021 08:25:35 +0100 Subject: [PATCH 10/10] Changing cdylib to staticlib, as the former doesn't work with arm-none-eabi-gcc. --- src/test/run-make/issue-10971-temps-dir/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/test/run-make/issue-10971-temps-dir/Makefile b/src/test/run-make/issue-10971-temps-dir/Makefile index f062e652a04..5ce27192603 100644 --- a/src/test/run-make/issue-10971-temps-dir/Makefile +++ b/src/test/run-make/issue-10971-temps-dir/Makefile @@ -3,11 +3,8 @@ # Regression test for issue #10971 # Running two invocations in parallel would overwrite each other's temp files. -## clean up unused env variables which might cause harm. -unexport RUSTC_LINKER - all: touch $(TMPDIR)/lib.rs $(RUSTC) --crate-type=lib -Z temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \ - $(RUSTC) --crate-type=cdylib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs + $(RUSTC) --crate-type=staticlib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs