diff options
| author | Tor Hovland <tor.hovland@bekk.no> | 2021-11-02 22:41:34 +0100 |
|---|---|---|
| committer | Tor Hovland <tor.hovland@bekk.no> | 2021-11-02 22:41:34 +0100 |
| commit | 5d1e09f44ab0bd3ca29acf44d92e884ec140d00a (patch) | |
| tree | 57ecc54c99e43c3668a72ad77b3d7cb8937cd15c /compiler/rustc_session/src | |
| parent | 18bc4bee9710b181b440a472635150f0d6257713 (diff) | |
| download | rust-5d1e09f44ab0bd3ca29acf44d92e884ec140d00a.tar.gz rust-5d1e09f44ab0bd3ca29acf44d92e884ec140d00a.zip | |
Added the --temps-dir option.
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 14 |
1 files changed, 12 insertions, 2 deletions
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<PathBuf>, + pub temps_directory: Option<PathBuf>, pub outputs: OutputTypes, } @@ -592,12 +593,14 @@ impl OutputFilenames { out_directory: PathBuf, out_filestem: String, single_output_file: Option<PathBuf>, + temps_directory: Option<PathBuf>, 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<RustcOptGroup> { in <dir>", "DIR", ), + opt::opt_s("", "temps-dir", "Write temporary output files to <dir>", "DIR"), opt::opt_s( "", "explain", |
