Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Add a --crate-name option #15939

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ pub fn opts() -> Vec<getopts::OptGroup> {
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", ""),
@@ -321,7 +322,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,
@@ -331,6 +332,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() {