Skip to content

Commit ede76c4

Browse files
author
Tor Hovland
committed
Made temps-dir an unstable option.
1 parent d4bcee9 commit ede76c4

File tree

11 files changed

+18
-24
lines changed

11 files changed

+18
-24
lines changed

compiler/rustc_driver/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,13 @@ fn run_compiler(
215215

216216
let cfg = interface::parse_cfgspecs(matches.opt_strs("cfg"));
217217
let (odir, ofile) = make_output(&matches);
218-
let temps_dir = make_temps_dir(&matches);
219218
let mut config = interface::Config {
220219
opts: sopts,
221220
crate_cfg: cfg,
222221
input: Input::File(PathBuf::new()),
223222
input_path: None,
224223
output_file: ofile,
225224
output_dir: odir,
226-
temps_dir,
227225
file_loader,
228226
diagnostic_output,
229227
stderr: None,
@@ -458,11 +456,6 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<PathBuf>)
458456
(odir, ofile)
459457
}
460458

461-
// Extract temporary directory from matches.
462-
fn make_temps_dir(matches: &getopts::Matches) -> Option<PathBuf> {
463-
matches.opt_str("temps-dir").map(|o| PathBuf::from(&o))
464-
}
465-
466459
// Extract input (string or file and optional path) from matches.
467460
fn make_input(
468461
error_format: ErrorOutputType,

compiler/rustc_interface/src/interface.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ pub struct Config {
143143
pub input_path: Option<PathBuf>,
144144
pub output_dir: Option<PathBuf>,
145145
pub output_file: Option<PathBuf>,
146-
pub temps_dir: Option<PathBuf>,
147146
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
148147
pub diagnostic_output: DiagnosticOutput,
149148

@@ -198,14 +197,16 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R
198197
);
199198
}
200199

200+
let temps_dir = sess.opts.debugging_opts.temps_dir.as_ref().map(|o| PathBuf::from(&o));
201+
201202
let compiler = Compiler {
202203
sess,
203204
codegen_backend,
204205
input: config.input,
205206
input_path: config.input_path,
206207
output_dir: config.output_dir,
207208
output_file: config.output_file,
208-
temps_dir: config.temps_dir,
209+
temps_dir,
209210
register_lints: config.register_lints,
210211
override_queries: config.override_queries,
211212
};

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ fn test_debugging_options_tracking_hash() {
685685
untracked!(span_debug, true);
686686
untracked!(span_free_formats, true);
687687
untracked!(strip, Strip::Debuginfo);
688+
untracked!(temps_dir, Some(String::from("abc")));
688689
untracked!(terminal_width, Some(80));
689690
untracked!(threads, 99);
690691
untracked!(time, true);

compiler/rustc_session/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,6 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
11101110
in <dir>",
11111111
"DIR",
11121112
),
1113-
opt::opt_s("", "temps-dir", "Write temporary output files to <dir>", "DIR"),
11141113
opt::opt_s(
11151114
"",
11161115
"explain",

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,8 @@ options! {
13311331
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
13321332
teach: bool = (false, parse_bool, [TRACKED],
13331333
"show extended diagnostic help (default: no)"),
1334+
temps_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
1335+
"the directory the intermediate files are written to"),
13341336
terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
13351337
"set the current terminal width"),
13361338
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],

src/doc/rustc/src/command-line-arguments.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,6 @@ This flag controls the output filename.
194194
The outputted crate will be written to this directory. This flag is ignored if
195195
the [`-o` flag](#option-o-output) is used.
196196

197-
<a id="option-temps-dir"></a>
198-
## `--temps-dir`: directory to write the intermediate files in
199-
200-
Intermediate files will be written to this directory. If not set, the output
201-
directory is used. This option is useful if you are running more than one
202-
instance of `rustc` (e.g. with different `--crate-type` settings), and you
203-
need to make sure they are not overwriting each other's intermediate files.
204-
No files are kept unless `-C save-temps=yes` is also set.
205-
206197
<a id="option-explain"></a>
207198
## `--explain`: provide a detailed explanation of an error message
208199

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# `temps-dir`
2+
3+
--------------------
4+
5+
The `-Ztemps-dir` compiler flag specifies the directory to write the
6+
intermediate files in. If not set, the output directory is used. This option is
7+
useful if you are running more than one instance of `rustc` (e.g. with different
8+
`--crate-type` settings), and you need to make sure they are not overwriting
9+
each other's intermediate files. No files are kept unless `-C save-temps=yes` is
10+
also set.

src/librustdoc/core.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ crate fn create_config(
259259
input_path: cpath,
260260
output_file: None,
261261
output_dir: None,
262-
temps_dir: None,
263262
file_loader: None,
264263
diagnostic_output: DiagnosticOutput::Default,
265264
stderr: None,

src/librustdoc/doctest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
9494
input_path: None,
9595
output_file: None,
9696
output_dir: None,
97-
temps_dir: None,
9897
file_loader: None,
9998
diagnostic_output: DiagnosticOutput::Default,
10099
stderr: None,

src/test/run-make-fulldeps/issue-19371/foo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
5353
input_path: None,
5454
output_file: Some(output),
5555
output_dir: None,
56-
temps_dir: None,
5756
file_loader: None,
5857
diagnostic_output: DiagnosticOutput::Default,
5958
stderr: None,

src/test/run-make/issue-10971-temps-dir/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ include ../../run-make-fulldeps/tools.mk
66
all:
77
touch $(TMPDIR)/lib.rs
88

9-
$(RUSTC) --crate-type=lib --temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \
10-
$(RUSTC) --crate-type=cdylib --temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs
9+
$(RUSTC) --crate-type=lib -Z temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \
10+
$(RUSTC) --crate-type=cdylib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs

0 commit comments

Comments
 (0)