diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 357c7238c1f6c..d4f164b6e24be 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -157,7 +157,7 @@ pub fn run_compiler<'a>(args: &[String], } }} - let matches = match handle_options(args.to_vec()) { + let matches = match handle_options(args) { Some(matches) => matches, None => return (Ok(()), None), }; @@ -870,9 +870,9 @@ fn print_flag_list(cmdline_opt: &str, /// /// So with all that in mind, the comments below have some more detail about the /// contortions done here to get things to work out correctly. -pub fn handle_options(mut args: Vec) -> Option { +pub fn handle_options(args: &[String]) -> Option { // Throw away the first argument, the name of the binary - let _binary = args.remove(0); + let args = &args[1..]; if args.is_empty() { // user did not write `-v` nor `-Z unstable-options`, so do not