Skip to content

Commit 237738f

Browse files
committed
rustdoc: Add a --crate-name option
Like rustc, this is required by cargo to build documentation.
1 parent 103d888 commit 237738f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustdoc/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub fn opts() -> Vec<getopts::OptGroup> {
102102
optopt("w", "output-format", "the output type to write",
103103
"[html|json]"),
104104
optopt("o", "output", "where to place the output", "PATH"),
105+
optopt("", "crate-name", "specify the name of this crate", "NAME"),
105106
optmulti("L", "library-path", "directory to add to crate search path",
106107
"DIR"),
107108
optmulti("", "cfg", "pass a --cfg to rustc", ""),
@@ -323,7 +324,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
323324

324325
let cr = Path::new(cratefile);
325326
info!("starting to run rustc");
326-
let (krate, analysis) = std::task::try(proc() {
327+
let (mut krate, analysis) = std::task::try(proc() {
327328
let cr = cr;
328329
core::run_core(libs.move_iter().collect(),
329330
cfgs,
@@ -333,6 +334,11 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
333334
info!("finished with rustc");
334335
analysiskey.replace(Some(analysis));
335336

337+
match matches.opt_str("crate-name") {
338+
Some(name) => krate.name = name,
339+
None => {}
340+
}
341+
336342
// Process all of the crate attributes, extracting plugin metadata along
337343
// with the passes which we are supposed to run.
338344
match krate.module.get_ref().doc_list() {

0 commit comments

Comments
 (0)