Skip to content

Commit 3cbcc5a

Browse files
Fix crate-name option in rustdoc
1 parent cdc193d commit 3cbcc5a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/librustdoc/core.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ pub fn run_core(search_paths: SearchPaths,
230230

231231
let krate = panictry!(driver::phase_1_parse_input(control, &sess, &input));
232232

233-
let name = ::rustc_codegen_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input);
233+
let name = match crate_name {
234+
Some(ref crate_name) => crate_name.clone(),
235+
None => ::rustc_codegen_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input),
236+
};
234237

235238
let mut crate_loader = CrateLoader::new(&sess, &cstore, &name);
236239

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: --crate-name foo
12+
13+
pub fn foo() {}

0 commit comments

Comments
 (0)