Repository navigation
fix(doc): do not suggest cargo fix for rustdoc warnings - #17702
Merged
weihanglo merged 2 commits intoNov 9, 2026
Merged
Conversation
cargo fix only runs rustc (in check mode) and cannot apply machine-applicable lint suggestions emitted by rustdoc, so suppress the cargo fix hint for Doc and Docscrape units. Fixes rust-lang#12277
Collaborator
|
r? @Muscraft rustbot has assigned @Muscraft. Use Why was this reviewer chosen?The reviewer was selected based on:
|
weihanglo
approved these changes
Nov 9, 2026
Member
There was a problem hiding this comment.
Thanks. We can track the overall rustdoc fix support in #13025
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Nov 11, 2026
Update cargo submodule 15 commits in c07ac2c4d12237effc4b94f4543769b421790045..ede6cefea9731cb595942338824c2f9a610b8189 2026-11-06 19:13:29 +0000 to 2026-11-11 12:33:16 +0000 - chore: bump to 0.103.0; update changelog (rust-lang/cargo#17709) - Update documentation about adding new publishable crates (rust-lang/cargo#17711) - test: Make cross compile test work with annotate-snippets whitespace changes (rust-lang/cargo#17707) - feat(config): Expose config merging, reading, and schemas in a crate (rust-lang/cargo#17705) - feat(schema): Expose SBOM types (rust-lang/cargo#17683) - fix: strip host deps whose debuginfo was weakened already (rust-lang/cargo#17691) - fix: dont strip if any transtive dep has debuginfo on (rust-lang/cargo#17689) - Reduce memory allocation in crate_type.rs (rust-lang/cargo#17706) - fix(doc): do not suggest cargo fix for rustdoc warnings (rust-lang/cargo#17702) - perf(parse): Trade remote manifest diagnostic quality for performance (rust-lang/cargo#17701) - refactor(config): Pull deserialiation into the config layer (rust-lang/cargo#17699) - Use trusted publishing for the home crate (rust-lang/cargo#17703) - refactor(benchsuite): Port to divan (rust-lang/cargo#17700) - fix(schema): Improve deserialization errors and performance (rust-lang/cargo#17697) - fix(lockfile): sort unused patches in Cargo.lock (rust-lang/cargo#17698)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Fixes #12277.
When
cargo docrunsrustdocon a local unit andrustdocemits a warning with a machine-applicable suggestion (such asrustdoc::bare_urlson a bare URL in a doc comment),DrainState::report_warning_countinsrc/compiler/job_queue/mod.rspreviously printed a suggestion to runcargo fix:However,
cargo fixonly runsrustc(incheckmode) and does not invokerustdoc(tracked separately as a feature request in #13025), so running the suggestedcargo fixcommand does not applyrustdoclint suggestions.This change updates
DrainState::report_warning_countto also excluderustdocunits (!unit.mode.is_doc() && !unit.mode.is_doc_scrape()), matching the condition used elsewhere insrc/compiler/to distinguishrustdocinvocations fromrustcinvocations.Notes to reviewers
test(doc): add test for rustdoc fixable warning summary) addsdoc::doc_fixable_warning_no_fix_suggestiondemonstrating the previous output.fix(doc): do not suggest cargo fix for rustdoc warnings) suppresses thecargo fixsuggestion forDocandDocscrapemodes and updates the test snapshot.rustdocunits will no longer display therun cargo fix ...hint untilcargo fixgains support forrustdoc(cargo fixdoesn't work for rustdoc lints #13025);rustcunits (including local workspace dependencies checked viarustcduringcargo doc) continue to suggestcargo fixas before.