Skip to content

Commit 7d3965e

Browse files
committed
Move make_input call
1 parent 4ac032f commit 7d3965e

File tree

1 file changed

+7
-12
lines changed
  • compiler/rustc_driver_impl/src

1 file changed

+7
-12
lines changed

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,17 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
243243
return;
244244
}
245245

246+
let input = make_input(&default_early_dcx, &matches.free);
247+
let has_input = input.is_some();
246248
let (odir, ofile) = make_output(&matches);
249+
250+
drop(default_early_dcx);
251+
247252
let mut config = interface::Config {
248253
opts: sopts,
249254
crate_cfg: matches.opt_strs("cfg"),
250255
crate_check_cfg: matches.opt_strs("check-cfg"),
251-
input: Input::File(PathBuf::new()),
256+
input: input.unwrap_or(Input::File(PathBuf::new())),
252257
output_file: ofile,
253258
output_dir: odir,
254259
ice_file,
@@ -265,16 +270,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
265270
expanded_args: args,
266271
};
267272

268-
let has_input = match make_input(&default_early_dcx, &matches.free) {
269-
Some(input) => {
270-
config.input = input;
271-
true // has input: normal compilation
272-
}
273-
None => false, // no input: we will exit early
274-
};
275-
276-
drop(default_early_dcx);
277-
278273
callbacks.config(&mut config);
279274

280275
let registered_lints = config.register_lints.is_some();
@@ -407,7 +402,7 @@ fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
407402
}
408403
}
409404

410-
// Extract output directory and file from matches.
405+
/// Extract output directory and file from matches.
411406
fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<OutFileName>) {
412407
let odir = matches.opt_str("out-dir").map(|o| PathBuf::from(&o));
413408
let ofile = matches.opt_str("o").map(|o| match o.as_str() {

0 commit comments

Comments
 (0)