Made temps-dir an unstable option.
This commit is contained in:
parent
d4bcee9638
commit
ede76c40d1
11 changed files with 18 additions and 24 deletions
|
@ -215,7 +215,6 @@ fn run_compiler(
|
||||||
|
|
||||||
let cfg = interface::parse_cfgspecs(matches.opt_strs("cfg"));
|
let cfg = interface::parse_cfgspecs(matches.opt_strs("cfg"));
|
||||||
let (odir, ofile) = make_output(&matches);
|
let (odir, ofile) = make_output(&matches);
|
||||||
let temps_dir = make_temps_dir(&matches);
|
|
||||||
let mut config = interface::Config {
|
let mut config = interface::Config {
|
||||||
opts: sopts,
|
opts: sopts,
|
||||||
crate_cfg: cfg,
|
crate_cfg: cfg,
|
||||||
|
@ -223,7 +222,6 @@ fn run_compiler(
|
||||||
input_path: None,
|
input_path: None,
|
||||||
output_file: ofile,
|
output_file: ofile,
|
||||||
output_dir: odir,
|
output_dir: odir,
|
||||||
temps_dir,
|
|
||||||
file_loader,
|
file_loader,
|
||||||
diagnostic_output,
|
diagnostic_output,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
|
@ -458,11 +456,6 @@ fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<PathBuf>)
|
||||||
(odir, ofile)
|
(odir, ofile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract temporary directory from matches.
|
|
||||||
fn make_temps_dir(matches: &getopts::Matches) -> Option<PathBuf> {
|
|
||||||
matches.opt_str("temps-dir").map(|o| PathBuf::from(&o))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract input (string or file and optional path) from matches.
|
// Extract input (string or file and optional path) from matches.
|
||||||
fn make_input(
|
fn make_input(
|
||||||
error_format: ErrorOutputType,
|
error_format: ErrorOutputType,
|
||||||
|
|
|
@ -143,7 +143,6 @@ pub struct Config {
|
||||||
pub input_path: Option<PathBuf>,
|
pub input_path: Option<PathBuf>,
|
||||||
pub output_dir: Option<PathBuf>,
|
pub output_dir: Option<PathBuf>,
|
||||||
pub output_file: Option<PathBuf>,
|
pub output_file: Option<PathBuf>,
|
||||||
pub temps_dir: Option<PathBuf>,
|
|
||||||
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
|
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
|
||||||
pub diagnostic_output: DiagnosticOutput,
|
pub diagnostic_output: DiagnosticOutput,
|
||||||
|
|
||||||
|
@ -198,6 +197,8 @@ pub fn create_compiler_and_run<R>(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 {
|
let compiler = Compiler {
|
||||||
sess,
|
sess,
|
||||||
codegen_backend,
|
codegen_backend,
|
||||||
|
@ -205,7 +206,7 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R
|
||||||
input_path: config.input_path,
|
input_path: config.input_path,
|
||||||
output_dir: config.output_dir,
|
output_dir: config.output_dir,
|
||||||
output_file: config.output_file,
|
output_file: config.output_file,
|
||||||
temps_dir: config.temps_dir,
|
temps_dir,
|
||||||
register_lints: config.register_lints,
|
register_lints: config.register_lints,
|
||||||
override_queries: config.override_queries,
|
override_queries: config.override_queries,
|
||||||
};
|
};
|
||||||
|
|
|
@ -685,6 +685,7 @@ fn test_debugging_options_tracking_hash() {
|
||||||
untracked!(span_debug, true);
|
untracked!(span_debug, true);
|
||||||
untracked!(span_free_formats, true);
|
untracked!(span_free_formats, true);
|
||||||
untracked!(strip, Strip::Debuginfo);
|
untracked!(strip, Strip::Debuginfo);
|
||||||
|
untracked!(temps_dir, Some(String::from("abc")));
|
||||||
untracked!(terminal_width, Some(80));
|
untracked!(terminal_width, Some(80));
|
||||||
untracked!(threads, 99);
|
untracked!(threads, 99);
|
||||||
untracked!(time, true);
|
untracked!(time, true);
|
||||||
|
|
|
@ -1110,7 +1110,6 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
|
||||||
in <dir>",
|
in <dir>",
|
||||||
"DIR",
|
"DIR",
|
||||||
),
|
),
|
||||||
opt::opt_s("", "temps-dir", "Write temporary output files to <dir>", "DIR"),
|
|
||||||
opt::opt_s(
|
opt::opt_s(
|
||||||
"",
|
"",
|
||||||
"explain",
|
"explain",
|
||||||
|
|
|
@ -1331,6 +1331,8 @@ options! {
|
||||||
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
|
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),
|
||||||
teach: bool = (false, parse_bool, [TRACKED],
|
teach: bool = (false, parse_bool, [TRACKED],
|
||||||
"show extended diagnostic help (default: no)"),
|
"show extended diagnostic help (default: no)"),
|
||||||
|
temps_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
||||||
|
"the directory the intermediate files are written to"),
|
||||||
terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
|
terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
|
||||||
"set the current terminal width"),
|
"set the current terminal width"),
|
||||||
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
|
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||||
|
|
|
@ -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 outputted crate will be written to this directory. This flag is ignored if
|
||||||
the [`-o` flag](#option-o-output) is used.
|
the [`-o` flag](#option-o-output) is used.
|
||||||
|
|
||||||
<a id="option-temps-dir"></a>
|
|
||||||
## `--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.
|
|
||||||
|
|
||||||
<a id="option-explain"></a>
|
<a id="option-explain"></a>
|
||||||
## `--explain`: provide a detailed explanation of an error message
|
## `--explain`: provide a detailed explanation of an error message
|
||||||
|
|
||||||
|
|
10
src/doc/unstable-book/src/compiler-flags/temps-dir.md
Normal file
10
src/doc/unstable-book/src/compiler-flags/temps-dir.md
Normal file
|
@ -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.
|
|
@ -259,7 +259,6 @@ crate fn create_config(
|
||||||
input_path: cpath,
|
input_path: cpath,
|
||||||
output_file: None,
|
output_file: None,
|
||||||
output_dir: None,
|
output_dir: None,
|
||||||
temps_dir: None,
|
|
||||||
file_loader: None,
|
file_loader: None,
|
||||||
diagnostic_output: DiagnosticOutput::Default,
|
diagnostic_output: DiagnosticOutput::Default,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
|
|
|
@ -94,7 +94,6 @@ crate fn run(options: Options) -> Result<(), ErrorReported> {
|
||||||
input_path: None,
|
input_path: None,
|
||||||
output_file: None,
|
output_file: None,
|
||||||
output_dir: None,
|
output_dir: None,
|
||||||
temps_dir: None,
|
|
||||||
file_loader: None,
|
file_loader: None,
|
||||||
diagnostic_output: DiagnosticOutput::Default,
|
diagnostic_output: DiagnosticOutput::Default,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
|
|
|
@ -53,7 +53,6 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) {
|
||||||
input_path: None,
|
input_path: None,
|
||||||
output_file: Some(output),
|
output_file: Some(output),
|
||||||
output_dir: None,
|
output_dir: None,
|
||||||
temps_dir: None,
|
|
||||||
file_loader: None,
|
file_loader: None,
|
||||||
diagnostic_output: DiagnosticOutput::Default,
|
diagnostic_output: DiagnosticOutput::Default,
|
||||||
stderr: None,
|
stderr: None,
|
||||||
|
|
|
@ -6,5 +6,5 @@ include ../../run-make-fulldeps/tools.mk
|
||||||
all:
|
all:
|
||||||
touch $(TMPDIR)/lib.rs
|
touch $(TMPDIR)/lib.rs
|
||||||
|
|
||||||
$(RUSTC) --crate-type=lib --temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \
|
$(RUSTC) --crate-type=lib -Z temps-dir=$(TMPDIR)/temp1 $(TMPDIR)/lib.rs & \
|
||||||
$(RUSTC) --crate-type=cdylib --temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs
|
$(RUSTC) --crate-type=cdylib -Z temps-dir=$(TMPDIR)/temp2 $(TMPDIR)/lib.rs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue