Refactor argument UTF-8 checking into rustc_driver::args::raw_args()

This commit is contained in:
beetrees 2023-05-15 18:35:14 +00:00
parent 63091b105d
commit fb87e606cc
No known key found for this signature in database
GPG key ID: 8791BD754191EBD6
3 changed files with 28 additions and 23 deletions

View file

@ -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()
});