Skip to content

Commit c95c0b1

Browse files
committed
Auto merge of #8449 - jyn514:rustdoc, r=ehuss
Don't overwrite existing `rustdoc` args with --document-private-items Instead, add that flag in addition to any existing flags. Closes #8445
2 parents 299514d + 1d1b344 commit c95c0b1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,10 @@ pub fn create_bcx<'a, 'cfg>(
476476
}
477477

478478
if let Some(args) = extra_args {
479-
extra_compiler_args.insert(unit.clone(), args.clone());
479+
extra_compiler_args
480+
.entry(unit.clone())
481+
.or_default()
482+
.extend(args);
480483
}
481484
}
482485
}

tests/testsuite/rustdoc.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ 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("--markdown-no-toc")
49+
.with_stderr_contains("[RUNNING] `rustdoc [..] --markdown-no-toc[..]`")
50+
.run();
51+
}
52+
4253
#[cargo_test]
4354
fn rustdoc_foo_with_bar_dependency() {
4455
let foo = project()

0 commit comments

Comments
 (0)