From 237738fa3ea266fb33f5a0c774347bf73bb20825 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 23 Jul 2014 21:46:49 -0700 Subject: [PATCH] rustdoc: Add a --crate-name option Like rustc, this is required by cargo to build documentation. --- src/librustdoc/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 70dc230b541..39b2511fde4 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -102,6 +102,7 @@ pub fn opts() -> Vec { optopt("w", "output-format", "the output type to write", "[html|json]"), optopt("o", "output", "where to place the output", "PATH"), + optopt("", "crate-name", "specify the name of this crate", "NAME"), optmulti("L", "library-path", "directory to add to crate search path", "DIR"), optmulti("", "cfg", "pass a --cfg to rustc", ""), @@ -323,7 +324,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche let cr = Path::new(cratefile); info!("starting to run rustc"); - let (krate, analysis) = std::task::try(proc() { + let (mut krate, analysis) = std::task::try(proc() { let cr = cr; core::run_core(libs.move_iter().collect(), cfgs, @@ -333,6 +334,11 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche info!("finished with rustc"); analysiskey.replace(Some(analysis)); + match matches.opt_str("crate-name") { + Some(name) => krate.name = name, + None => {} + } + // Process all of the crate attributes, extracting plugin metadata along // with the passes which we are supposed to run. match krate.module.get_ref().doc_list() { -- GitLab