about summary refs log tree commit diff
path: root/compiler/rustc_driver/src/lib.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-19 02:49:12 +0100
committerGitHub <noreply@github.com>2021-02-19 02:49:12 +0100
commitd9bc16cf368f1a8701295ed83f0337461acd6963 (patch)
treef488908a9af717c89d066768b94c05feb42df380 /compiler/rustc_driver/src/lib.rs
parentcc01bbe8f0cf7b19053c5f0578992cb7d2f4bba8 (diff)
parent755b3fc722c36d9761bf49c246b5f7c85a62380d (diff)
downloadrust-d9bc16cf368f1a8701295ed83f0337461acd6963.tar.gz
rust-d9bc16cf368f1a8701295ed83f0337461acd6963.zip
Rollup merge of #82261 - ojeda:rustdoc-argfile, r=jyn514
rustdoc: Support argument files

Factors out the `rustc_driver` logic that handles argument files so that rustdoc supports them as well, e.g.:

    rustdoc `@argfile`

This is needed to be able to generate docs for projects that already use argument files when compiling them, e.g. projects that pass a huge number of `--cfg` arguments.

The feature was stabilized for `rustc` in #66172.
Diffstat (limited to 'compiler/rustc_driver/src/lib.rs')
-rw-r--r--compiler/rustc_driver/src/lib.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index 8295e88f75a..cad5a87bb13 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -55,7 +55,7 @@ use std::process::{self, Command, Stdio};
 use std::str;
 use std::time::Instant;
 
-mod args;
+pub mod args;
 pub mod pretty;
 
 /// Exit status code used for successful compilation and help output.
@@ -188,16 +188,8 @@ fn run_compiler(
         Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>,
     >,
 ) -> interface::Result<()> {
-    let mut args = Vec::new();
-    for arg in at_args {
-        match args::arg_expand(arg.clone()) {
-            Ok(arg) => args.extend(arg),
-            Err(err) => early_error(
-                ErrorOutputType::default(),
-                &format!("Failed to load argument file: {}", err),
-            ),
-        }
-    }
+    let args = args::arg_expand_all(at_args);
+
     let diagnostic_output = emitter.map_or(DiagnosticOutput::Default, DiagnosticOutput::Raw);
     let matches = match handle_options(&args) {
         Some(matches) => matches,