Refactor argument UTF-8 checking into rustc_driver::args::raw_args()
This commit is contained in:
parent
63091b105d
commit
fb87e606cc
3 changed files with 28 additions and 23 deletions
|
@ -179,21 +179,14 @@ pub fn main() {
|
|||
rustc_driver::init_logger(&early_dcx, rustc_log::LoggerConfig::from_env("RUSTDOC_LOG"));
|
||||
|
||||
let exit_code = rustc_driver::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<_>>();
|
||||
main_args(&mut early_dcx, &args, using_internal_features)
|
||||
let at_args = rustc_driver::args::raw_args(&early_dcx)?;
|
||||
main_args(&mut early_dcx, &at_args, using_internal_features)
|
||||
});
|
||||
process::exit(exit_code);
|
||||
}
|
||||
|
||||
fn init_logging(early_dcx: &EarlyDiagCtxt) {
|
||||
let color_logs = match std::env::var("RUSTDOC_LOG_COLOR").as_deref() {
|
||||
let color_logs = match env::var("RUSTDOC_LOG_COLOR").as_deref() {
|
||||
Ok("always") => true,
|
||||
Ok("never") => false,
|
||||
Ok("auto") | Err(VarError::NotPresent) => io::stdout().is_terminal(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue