Skip to content

Commit 2c33568

Browse files
committed
rustdoc: Support --extern-private but treat as --extern
This makes `rustdoc` support `--extern-private` but treats it the same as `--extern` which is useful for making the CLI more similar to `rustc` to ease test suite integration. Signed-off-by: Daniel Silverstone <[email protected]>
1 parent 3f0e164 commit 2c33568

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/librustdoc/config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,12 @@ fn parse_extern_html_roots(
608608
/// Extracts `--extern CRATE=PATH` arguments from `matches` and
609609
/// returns a map mapping crate names to their paths or else an
610610
/// error message.
611+
/// Also handles `--extern-private` which for the purposes of rustdoc
612+
/// we can treat as `--extern`
611613
// FIXME(eddyb) This shouldn't be duplicated with `rustc::session`.
612614
fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
613615
let mut externs: BTreeMap<_, ExternEntry> = BTreeMap::new();
614-
for arg in &matches.opt_strs("extern") {
616+
for arg in matches.opt_strs("extern").iter().chain(matches.opt_strs("extern-private").iter()) {
615617
let mut parts = arg.splitn(2, '=');
616618
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
617619
let location = parts.next().map(|s| s.to_string());

src/librustdoc/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ fn opts() -> Vec<RustcOptGroup> {
142142
stable("extern", |o| {
143143
o.optmulti("", "extern", "pass an --extern to rustc", "NAME=PATH")
144144
}),
145+
stable("extern-private", |o| {
146+
o.optmulti("", "extern-private",
147+
"pass an --extern to rustc (compatibility only)", "NAME=PATH")
148+
}),
145149
unstable("extern-html-root-url", |o| {
146150
o.optmulti("", "extern-html-root-url",
147151
"base URL to use for dependencies", "NAME=URL")

0 commit comments

Comments
 (0)