From 3e07a3e66020fe56a570e211e469045faff31bfa Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Wed, 14 Mar 2018 15:50:09 +0100 Subject: [PATCH] Fix a bug in #5152 that causes rustc/rustdoc to fail unnecessarily --- src/bin/commands/rustc.rs | 7 ++++++- src/bin/commands/rustdoc.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bin/commands/rustc.rs b/src/bin/commands/rustc.rs index 268b835a630..b53e5a8abd1 100644 --- a/src/bin/commands/rustc.rs +++ b/src/bin/commands/rustc.rs @@ -62,7 +62,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { } }; let mut compile_opts = args.compile_options_for_single_package(config, mode)?; - compile_opts.target_rustc_args = Some(values(args, "args")); + let target_args = values(args, "args"); + compile_opts.target_rustc_args = if target_args.is_empty() { + None + } else { + Some(target_args) + }; ops::compile(&ws, &compile_opts)?; Ok(()) } diff --git a/src/bin/commands/rustdoc.rs b/src/bin/commands/rustdoc.rs index f3744cebf16..1712b855992 100644 --- a/src/bin/commands/rustdoc.rs +++ b/src/bin/commands/rustdoc.rs @@ -49,7 +49,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { let ws = args.workspace(config)?; let mut compile_opts = args.compile_options_for_single_package(config, CompileMode::Doc { deps: false })?; - compile_opts.target_rustdoc_args = Some(values(args, "args")); + let target_args = values(args, "args"); + compile_opts.target_rustdoc_args = if target_args.is_empty() { + None + } else { + Some(target_args) + }; let doc_opts = DocOptions { open_result: args.is_present("open"), compile_opts,