diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-08 13:22:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-08 13:22:25 +0100 |
| commit | a8e3543b19fae1b7fa3acc3ba5de10d0eba8a2c4 (patch) | |
| tree | 3d26e13575710eb29ec2a59227aa3d7f2c376da5 /compiler/rustc_driver_impl/src/lib.rs | |
| parent | 075f1c34d49918d1fdad0f2950fb39934535954a (diff) | |
| parent | 2d7d0bda4334b1b7be951ff45c4397dab0a1dd32 (diff) | |
Rollup merge of #121194 - beetrees:rustc-raw-args, r=petrochenkov
Refactor pre-getopts command line argument handling Rebased version of #111658. I've also fixed the Windows CI failure (although I don't have access to Windows to test it myself).
Diffstat (limited to 'compiler/rustc_driver_impl/src/lib.rs')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 89ab5c6bd3b..e06d1d245b2 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -292,7 +292,7 @@ fn run_compiler( // the compiler with @empty_file as argv[0] and no more arguments. let at_args = at_args.get(1..).unwrap_or_default(); - let args = args::arg_expand_all(&default_early_dcx, at_args); + let args = args::arg_expand_all(&default_early_dcx, at_args)?; let Some(matches) = handle_options(&default_early_dcx, &args) else { return Ok(()) }; @@ -1515,15 +1515,7 @@ pub fn main() -> ! { let mut callbacks = TimePassesCallbacks::default(); let using_internal_features = install_ice_hook(DEFAULT_BUG_REPORT_URL, |_| ()); let exit_code = catch_with_exit_code(|| { - let args = env::args_os() - .enumerate() - .map(|(i, arg)| { - arg.into_string().unwrap_or_else(|arg| { - early_dcx.early_fatal(format!("argument {i} is not valid Unicode: {arg:?}")) - }) - }) - .collect::<Vec<_>>(); - RunCompiler::new(&args, &mut callbacks) + RunCompiler::new(&args::raw_args(&early_dcx)?, &mut callbacks) .set_using_internal_features(using_internal_features) .run() }); |
