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.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
@@ -432,13 +432,16 @@ fn usage(argv0: &str) {
|
||||
(option.apply)(&mut options);
|
||||
}
|
||||
println!("{}", options.usage(&format!("{} [options] <input>", argv0)));
|
||||
println!(" @path Read newline separated options from `path`\n");
|
||||
println!("More information available at https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html")
|
||||
}
|
||||
|
||||
/// A result type used by several functions under `main()`.
|
||||
type MainResult = Result<(), ErrorReported>;
|
||||
|
||||
fn main_args(args: &[String]) -> MainResult {
|
||||
fn main_args(at_args: &[String]) -> MainResult {
|
||||
let args = rustc_driver::args::arg_expand_all(at_args);
|
||||
|
||||
let mut options = getopts::Options::new();
|
||||
for option in opts() {
|
||||
(option.apply)(&mut options);
|
||||
|
||||
Reference in New Issue
Block a user