diff options
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 19 | 
1 files changed, 7 insertions, 12 deletions
| diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 8ede6e41336..4a3037bb971 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -243,12 +243,17 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) return; } + let input = make_input(&default_early_dcx, &matches.free); + let has_input = input.is_some(); let (odir, ofile) = make_output(&matches); + + drop(default_early_dcx); + let mut config = interface::Config { opts: sopts, crate_cfg: matches.opt_strs("cfg"), crate_check_cfg: matches.opt_strs("check-cfg"), - input: Input::File(PathBuf::new()), + input: input.unwrap_or(Input::File(PathBuf::new())), output_file: ofile, output_dir: odir, ice_file, @@ -265,16 +270,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) expanded_args: args, }; - let has_input = match make_input(&default_early_dcx, &matches.free) { - Some(input) => { - config.input = input; - true // has input: normal compilation - } - None => false, // no input: we will exit early - }; - - drop(default_early_dcx); - callbacks.config(&mut config); let registered_lints = config.register_lints.is_some(); @@ -407,7 +402,7 @@ fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) { } } -// Extract output directory and file from matches. +/// Extract output directory and file from matches. fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<OutFileName>) { let odir = matches.opt_str("out-dir").map(|o| PathBuf::from(&o)); let ofile = matches.opt_str("o").map(|o| match o.as_str() { | 
