@@ -243,12 +243,17 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
243
243
return ;
244
244
}
245
245
246
+ let input = make_input( & default_early_dcx, & matches. free) ;
247
+ let has_input = input. is_some( ) ;
246
248
let ( odir, ofile) = make_output( & matches) ;
249
+
250
+ drop( default_early_dcx) ;
251
+
247
252
let mut config = interface:: Config {
248
253
opts: sopts,
249
254
crate_cfg: matches. opt_strs( "cfg" ) ,
250
255
crate_check_cfg: matches. opt_strs( "check-cfg" ) ,
251
- input: Input :: File ( PathBuf :: new( ) ) ,
256
+ input: input . unwrap_or ( Input :: File ( PathBuf :: new( ) ) ) ,
252
257
output_file: ofile,
253
258
output_dir: odir,
254
259
ice_file,
@@ -265,16 +270,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
265
270
expanded_args: args,
266
271
} ;
267
272
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
-
278
273
callbacks. config( & mut config) ;
279
274
280
275
let registered_lints = config. register_lints. is_some( ) ;
@@ -407,7 +402,7 @@ fn dump_feature_usage_metrics(tcxt: TyCtxt<'_>, metrics_dir: &Path) {
407
402
}
408
403
}
409
404
410
- // Extract output directory and file from matches.
405
+ /// Extract output directory and file from matches.
411
406
fn make_output( matches: & getopts:: Matches ) -> ( Option <PathBuf >, Option <OutFileName >) {
412
407
let odir = matches. opt_str( "out-dir" ) . map( |o| PathBuf :: from( & o) ) ;
413
408
let ofile = matches. opt_str( "o" ) . map( |o| match o. as_str( ) {
0 commit comments