-
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
cargo fix
: Call rustc fewer times.
#13243
Merged
Merged
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
This adds a set of tests which validates various edge cases around how `cargo fix` works in terms of calling `rustc` multiple times. This uses a replacement of `rustc` so it doesn't depend on the behavior of rustc itself which is not always stable.
This changes `cargo fix` so that it keeps track of the output so that it doesn't need to run the final "show the output" step.
r? @epage (rustbot has picked a reviewer for you, use r? to override) |
Unknown labels: A-errors |
weihanglo
added
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
Command-fix
labels
Jan 2, 2024
Thanks! @bors r+ |
bors
added
the
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
label
Jan 3, 2024
☀️ Test successful - checks-actions |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 6, 2024
Update cargo 10 commits in add15366eaf3f3eb84717d3b8b71902ca36a7c84..2ce45605d9db521b5fd6c1211ce8de6055fdb24e 2024-01-02 03:24:42 +0000 to 2024-01-04 18:04:13 +0000 - feat(embedded): Add prefix-char frontmatter syntax support (rust-lang/cargo#13247) - Update dependency handlebars to v5 for mdman. (rust-lang/cargo#13249) - Deprecate rustc plugin support in cargo (rust-lang/cargo#13248) - feat(embedded): Add multiple experimental manifest syntaxes (rust-lang/cargo#13241) - chore: update auto labels (rust-lang/cargo#13244) - test: support publish package with a `public` field. (rust-lang/cargo#13245) - `cargo fix`: Call rustc fewer times. (rust-lang/cargo#13243) - chore: tracing be compat with rustc_log (rust-lang/cargo#13239) - chore(deps): update compatible (rust-lang/cargo#13227) - Contrib: Fix team HackMD links (rust-lang/cargo#13237) r? ghost
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
Command-fix
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
This is an improvement of
cargo fix
so that it callsrustc
one fewer times per target. The original code an extra step of callingrustc
to display final diagnostics to the user. Part of the reason is that in the past, cargo did not always use JSON, and socargo fix
was forced to callrustc
with and without JSON. Now that cargo uses JSON all the time, that is not necessary. This avoids the final call torustc
by remembering the original output fromrustc
.This needs to keep track of both the first and last output from
rustc
. This is to handle the situation wherecargo fix
fails to apply some suggestion (either because the verification fails, orrustfix
fails). Thecargo fix
output includes both the error, and the original diagnostics before the error.The first commit is a little test framework to exercise the various edge cases around how fix works. The comments should explain how it works, but it essentially has a
rustc
replacement that emits various different diagnostics and counts how often it is called.The subsequent commit includes the change to keep track of the output from
rustc
and to avoid the final call.Fixes #13215