Skip to content

Commit 689d9a7

Browse files
Don't filter on workspace members when scraping doc examples
1 parent 95a27cd commit 689d9a7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ fn prepare_rustdoc(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult<ProcessBuil
743743
.arg(scrape_output_path(cx, unit)?);
744744

745745
// Only scrape example for items from crates in the workspace, to reduce generated file size
746-
for pkg in cx.bcx.ws.members() {
746+
for pkg in cx.bcx.packages.packages() {
747747
let names = pkg
748748
.targets()
749749
.iter()

tests/testsuite/docscrape.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ fn basic() {
4848
assert!(p.build_dir().join("doc/src/ex/ex.rs.html").exists());
4949
}
5050

51-
// This test ensures that if there is no `[workspace]` in the top-level `Cargo.toml` file, the
52-
// dependencies will not get their examples scraped and that they appear in the generated
53-
// documentation.
51+
// This test ensures that even if there is no `[workspace]` in the top-level `Cargo.toml` file, the
52+
// dependencies will get their examples scraped and that they appear in the generated documentation.
5453
#[cargo_test(nightly, reason = "-Zrustdoc-scrape-examples is unstable")]
5554
fn scrape_examples_for_non_workspace_reexports() {
5655
let p = project()
@@ -124,7 +123,7 @@ impl Foo {
124123
.run();
125124

126125
let doc_html = p.read_file("target/doc/foo/struct.Foo.html");
127-
assert!(!doc_html.contains("Examples found in repository"));
126+
assert!(doc_html.contains("Examples found in repository"));
128127
}
129128

130129
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]

0 commit comments

Comments
 (0)