-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation for -Zrustdoc-scrape-examples in the Cargo Book #11425
Merged
bors
merged 1 commit into
rust-lang:master
from
willcrichton:scrape-examples-documentation
Nov 26, 2022
Merged
Update documentation for -Zrustdoc-scrape-examples in the Cargo Book #11425
bors
merged 1 commit into
rust-lang:master
from
willcrichton:scrape-examples-documentation
Nov 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rustbot
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Nov 26, 2022
weihanglo
approved these changes
Nov 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@bors r+ |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Nov 26, 2022
☀️ Test successful - checks-actions |
epage
added a commit
to clap-rs/clap
that referenced
this pull request
Nov 29, 2022
We were broken by rust-lang/cargo#10343. See rust-lang/cargo#11425 Fixes #4519
bors
added a commit
that referenced
this pull request
Nov 29, 2022
Improve strategy for selecting targets to be scraped for examples ### What does this PR try to resolve? After #10343, we have identified a clear set of conditions for whether a particular target should be considered by `-Zrustdoc-scrape-examples`. These conditions are described more clearly in #11425. However, after some testing with complex Cargo workspaces (e.g. [wasmtime](https://github.com/bytecodealliance/wasmtime/)), I realized that the current approach of modifying the `CompileFilter` did not correctly implement this new specification. For example, a target with `doc = false` should not be scraped by default since it is not a documented unit, but the current approach would potentially include such a target for scraping. This PR provides a new approach which I believe correctly implements the specification: 1. `generate_targets` is called with the same parameters except the `mode` which becomes `CompileMode::Docscrape` instead of `CompileMode::Doc`. `filter_default_targets` generates the same targets for `Docscrape` as for `Doc`. 2. Inside `generate_targets`, an initial set of `Proposal`s are created. This set of proposals is extended with further proposals based on targets identified as `doc-scrape-examples = true`, or Example targets where possible. This PR subsumes #11423, and also fixes #10571. ### How should we test and review this PR? I have added another test `docscrape::only_scrape_documented_targets` to verify that only documented or explicitly-enabled targets are included for scraping. r? `@weihanglo`
weihanglo
added a commit
to weihanglo/rust
that referenced
this pull request
Dec 3, 2022
9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306 2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000 - Refactor generate_targets into separate module (rust-lang/cargo#11445) - Improve file found in multiple build targets warning (rust-lang/cargo#11299) - Error when precise without -p flag (rust-lang/cargo#11349) - Improve strategy for selecting targets to be scraped for examples (rust-lang/cargo#11430) - Aware of compression ratio for unpack size limit (rust-lang/cargo#11337) - Add test for rustdoc-map generation when using sparse registries (rust-lang/cargo#11403) - Add error message when `cargo fix` on an empty repo (rust-lang/cargo#11400) - Store the sparse+ prefix in the SourceId for sparse registries (rust-lang/cargo#11387) - Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (rust-lang/cargo#11425)
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 3, 2022
Update cargo 9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306 2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000 - Refactor generate_targets into separate module (rust-lang/cargo#11445) - Improve file found in multiple build targets warning (rust-lang/cargo#11299) - Error when precise without -p flag (rust-lang/cargo#11349) - Improve strategy for selecting targets to be scraped for examples (rust-lang/cargo#11430) - Aware of compression ratio for unpack size limit (rust-lang/cargo#11337) - Add test for rustdoc-map generation when using sparse registries (rust-lang/cargo#11403) - Add error message when `cargo fix` on an empty repo (rust-lang/cargo#11400) - Store the sparse+ prefix in the SourceId for sparse registries (rust-lang/cargo#11387) - Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (rust-lang/cargo#11425)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Z-scrape-examples
Nightly: rustdoc scrape examples
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
Description in the title. Fixes #11424.
How should we test and review this PR?
Here's a screenshot of the updated documentation:
r? @weihanglo