Skip to content

Commit bb95188

Browse files
committed
Don't overwrite existing rustdoc args with --document-private-items
Instead, add that flag in addition to any existing flags.
1 parent fede83c commit bb95188

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,13 @@ pub fn create_bcx<'a, 'cfg>(
475475
extra_args = Some(args);
476476
}
477477

478-
if let Some(args) = extra_args {
479-
extra_compiler_args.insert(unit.clone(), args.clone());
478+
if let Some(mut args) = extra_args {
479+
match extra_compiler_args.get_mut(&unit) {
480+
None => {
481+
extra_compiler_args.insert(unit.clone(), args);
482+
}
483+
Some(existing) => existing.append(&mut args),
484+
}
480485
}
481486
}
482487
}

tests/testsuite/rustdoc.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ fn rustdoc_args() {
3939
.run();
4040
}
4141

42+
#[cargo_test]
43+
fn rustdoc_binary_args_passed() {
44+
let p = project().file("src/main.rs", "").build();
45+
46+
p.cargo("rustdoc -v")
47+
.arg("--")
48+
.arg("--theme")
49+
.arg("dark")
50+
.with_stderr_contains("[RUNNING] `rustdoc [..] --theme dark[..]`")
51+
.with_status(101)
52+
.run();
53+
}
54+
4255
#[cargo_test]
4356
fn rustdoc_foo_with_bar_dependency() {
4457
let foo = project()

0 commit comments

Comments
 (0)