fix(ops): correct error messages for cargo fix --broken-code#16681
fix(ops): correct error messages for cargo fix --broken-code#16681raushan728 wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
r? @ehuss rustbot has assigned @ehuss. Use Why was this reviewer chosen?The reviewer was selected based on:
|
3973cf9 to
68ced81
Compare
|
r? epage |
|
A couple of quick notes
|
|
thanks for the review @epage
Happy to iterate on this! |
Thats the intention of that label: it needs that design work done.
I'm less concerned about the number of PRs and more about this closing the Issue without fully resolving it
shell notes, warns, etc
See our contrib docs: https://doc.crates.io/contrib/implementation/console.html |
|
thanks for docs @epage
this should fully resolve both example from the issue. will push update soon! |
68ced81 to
8c3c403
Compare
|
ready for re-review @epage |
|
I realized there were some misunderstandings on both our parts on this code and am working through some prep PRs to help straighten that out |
tests/testsuite/fix_n_times.rs
Outdated
| Note that you may be able to make some more progress in the near-term | ||
| fixing code with the `--broken-code` flag | ||
|
|
||
| [WARNING] could not apply fixes; the code is already in a broken state. consider using `--broken-code` to save partial progress |
There was a problem hiding this comment.
This error does not look like the case in Example 2. Are we sure we have the right situation?
There was a problem hiding this comment.
Are we no longer addressing Example 2?
src/cargo/util/diagnostic_server.rs
Outdated
| self.gctx.shell().warn( | ||
| "could not apply fixes; the code is already in a \ | ||
| broken state. broken code was saved as requested \ | ||
| with `--broken-code`", | ||
| )?; |
There was a problem hiding this comment.
I don't think this message is accurate. It looks like the fixes are applied but we want to report that it still fails
### What does this PR try to resolve? Instead of printing a warning as a - a warning - many individual blocks of text this switches us to print it all as a single warning. This will make it easier to adapt to annotate-snippets in the future (work is in progress). This was noticed while reviewing #16681 which led us down the wrong path there. ### How to test and review this PR?
This comment has been minimized.
This comment has been minimized.
bcf4239 to
dffe9cf
Compare
This comment has been minimized.
This comment has been minimized.
|
Hey @epage, conflict resolved i have also updated the warning message wording and fixed the fix_n_times test assertions based on your feedback (Note: The current CI failures seem to be unrelated nightly script breakages) |
A review was requested my I don't think my comments were addressed |
This comment has been minimized.
This comment has been minimized.
|
#16711 is now merged and it is safe to rebase |
dffe9cf to
23ac6a1
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
23ac6a1 to
a1e21c0
Compare
a1e21c0 to
fcde359
Compare
|
@epage I respect your time, but could you please take a look at this once |
|
I have questions above that have not been addressed. |
Sorry, I didn't get it.
|
| .with_stderr_contains("[ERROR] errors present after applying fixes to crate `foo`") | ||
| .with_stderr_contains("[WARNING] fixes were applied but the code still does not compile; partially-fixed code was saved due to `--broken-code`") | ||
| .with_stderr_contains("[NOTE] original diagnostics will follow:") | ||
| .with_stderr_contains("[..]= cause: error[E0308]: mismatched types[..]") |
There was a problem hiding this comment.
Why were these changed from snapshots to contains?
| }; | ||
|
|
||
| let report = &[ | ||
| let issue_link = get_bug_report_url(self.workspace_wrapper); |
There was a problem hiding this comment.
Why was this line moved?
Unnecessary changes create noise in browsing diffs, making it harder to infer intent. When there are non-functional changes, prefer moving them to a refactor commit
| // FIXME: The error message here is not correct with --broken-code. | ||
| // https://github.com/rust-lang/cargo/issues/10955 | ||
| if fixes.files.is_empty() { | ||
| if fixes.files.is_empty() && !allow_broken_code { |
There was a problem hiding this comment.
Multiple changes are being done at once in this commit. Please split up individual changes to better describe in their commit their intent and to make it clearer by more incremental test updates.
In #16681 (comment), I asked a question and got no response. Code changes were made but it is unclear how they are in response to my questions. Looking at |
Fixes #10955
When
cargo fixapplies suggestions but the codestill fails to compile, the error message was
misleading. This PR corrects the warning wording
and updates the relevant tests.