Problem
In killercup/test-rustdoc-example-scraping-across-workspace-on-docrs#1 and in rust-lang/docs.rs#2305, we were able to find out that if you re-export non-workspace members, examples would not be scraped for them
Steps
$ git clone https://github.com/killercup/test-rustdoc-example-scraping-across-workspace-on-docrs.git
$ cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples
$ ... open in browser and see no examples
$ git checkout HEAD~
$ cargo +nightly doc -Zunstable-options -Zrustdoc-scrape-examples
$ ... open in browser and see examples
Possible Solution(s)
When scraping examples from a package, cargo only asks for examples that use APIs from specific crates, presumably for performance reasons
// Only scrape example for items from crates in the workspace, to reduce generated file size
for pkg in cx.bcx.ws.members() {
let names = pkg
.targets()
.iter()
.map(|target| target.crate_name())
.collect::<HashSet<_>>();
for name in names {
rustdoc.arg("--scrape-examples-target-crate").arg(name);
}
}
This is filtered to workspace members. Really what is needed is filtering for public dependencies which has recently been revived (rust-lang/rfcs#3516).
If the performance hit is not noticeable enough, we likely can remove this completely.
If the performance his is noticeable enough, the path forward:
- Long term: switch this to filtering on public normal dependencies (recursively)
- Short term: decide whether to
- keep filtering by workspace members
- take the perf hit and do no filtering
- filter for all normal dependencies, recursively
Notes
No response
Version
No response
Problem
In killercup/test-rustdoc-example-scraping-across-workspace-on-docrs#1 and in rust-lang/docs.rs#2305, we were able to find out that if you re-export non-workspace members, examples would not be scraped for them
Steps
Possible Solution(s)
When scraping examples from a package, cargo only asks for examples that use APIs from specific crates, presumably for performance reasons
This is filtered to workspace members. Really what is needed is filtering for public dependencies which has recently been revived (rust-lang/rfcs#3516).
If the performance hit is not noticeable enough, we likely can remove this completely.
If the performance his is noticeable enough, the path forward:
Notes
No response
Version
No response