Skip to content

Commit 706eb16

Browse files
committed
Rename early_error_handler as default_handler.
Yes, its type is `EarlyErrorHandler`, but there is another value of that type later on in the function called `handler` that is initialized with `sopts.error_format`. So `default_handler` is a better name because it clarifies that it is initialized with `ErrorOutputType::default()`.
1 parent e886137 commit 706eb16

File tree

1 file changed

+9
-9
lines changed
  • compiler/rustc_driver_impl/src

1 file changed

+9
-9
lines changed

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ fn run_compiler(
293293
>,
294294
using_internal_features: Arc<std::sync::atomic::AtomicBool>,
295295
) -> interface::Result<()> {
296-
let mut early_error_handler = EarlyErrorHandler::new(ErrorOutputType::default());
296+
let mut default_handler = EarlyErrorHandler::new(ErrorOutputType::default());
297297

298298
// Throw away the first argument, the name of the binary.
299299
// In case of at_args being empty, as might be the case by
@@ -305,14 +305,14 @@ fn run_compiler(
305305
// the compiler with @empty_file as argv[0] and no more arguments.
306306
let at_args = at_args.get(1..).unwrap_or_default();
307307

308-
let args = args::arg_expand_all(&early_error_handler, at_args);
308+
let args = args::arg_expand_all(&default_handler, at_args);
309309

310-
let Some(matches) = handle_options(&early_error_handler, &args) else { return Ok(()) };
310+
let Some(matches) = handle_options(&default_handler, &args) else { return Ok(()) };
311311

312-
let sopts = config::build_session_options(&mut early_error_handler, &matches);
312+
let sopts = config::build_session_options(&mut default_handler, &matches);
313313

314314
if let Some(ref code) = matches.opt_str("explain") {
315-
handle_explain(&early_error_handler, diagnostics_registry(), code, sopts.color);
315+
handle_explain(&default_handler, diagnostics_registry(), code, sopts.color);
316316
return Ok(());
317317
}
318318

@@ -338,7 +338,7 @@ fn run_compiler(
338338
expanded_args: args,
339339
};
340340

341-
match make_input(&early_error_handler, &matches.free) {
341+
match make_input(&default_handler, &matches.free) {
342342
Err(reported) => return Err(reported),
343343
Ok(Some(input)) => {
344344
config.input = input;
@@ -349,7 +349,7 @@ fn run_compiler(
349349
0 => {
350350
callbacks.config(&mut config);
351351

352-
early_error_handler.abort_if_errors();
352+
default_handler.abort_if_errors();
353353

354354
interface::run_compiler(config, |compiler| {
355355
let sopts = &compiler.session().opts;
@@ -374,14 +374,14 @@ fn run_compiler(
374374
return Ok(());
375375
}
376376
1 => panic!("make_input should have provided valid inputs"),
377-
_ => early_error_handler.early_error(format!(
377+
_ => default_handler.early_error(format!(
378378
"multiple input filenames provided (first two filenames are `{}` and `{}`)",
379379
matches.free[0], matches.free[1],
380380
)),
381381
},
382382
};
383383

384-
early_error_handler.abort_if_errors();
384+
default_handler.abort_if_errors();
385385

386386
interface::run_compiler(config, |compiler| {
387387
let sess = compiler.session();

0 commit comments

Comments
 (0)