From 93f69b23006d180e2f6cf2d6f7efeab17b2c2cf2 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 19 Jan 2025 13:12:07 +1100 Subject: [PATCH] Don't skip argument parsing when running `rustc` with no arguments Setting up the argument parser to parse no arguments is a tiny bit of wasted work, but avoids an otherwise-unnecessary special case. In particular, this lets us avoid having to deal with multiple different APIs to determine whether the compiler is nightly or not. --- compiler/rustc_driver_impl/src/lib.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 0413e5e86348b..f7e7aa6461421 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1191,15 +1191,6 @@ fn print_flag_list(cmdline_opt: &str, flag_list: &[OptionDesc]) { /// be public when using rustc as a library, see /// pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option { - if args.is_empty() { - // user did not write `-v` nor `-Z unstable-options`, so do not - // include that extra information. - let nightly_build = - rustc_feature::UnstableFeatures::from_environment(None).is_nightly_build(); - usage(false, false, nightly_build); - return None; - } - // Parse with *all* options defined in the compiler, we don't worry about // option stability here we just want to parse as much as possible. let mut options = getopts::Options::new(); @@ -1245,7 +1236,7 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option