-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Show diff suggestion format on verbose replacement #127541
Conversation
This is in response to #127407 (comment). This also highlights that there are multiple places where the suggestions could have more accurate spans. We should also improve the diff presentation to automatically skip pieces that haven't changed so that suggestions can continue to be built easily when possible. |
Does the verbose suggestion highlight (in color mode) the thing being replaced? What I mean is that before, the Adding a |
This comment was marked as resolved.
This comment was marked as resolved.
b00adfa
to
d470334
Compare
@oli-obk sorry about the last commit, it was an effort to simultaneously fix a papercut and have an SVG file to show different patch renderings, but even that backfired because GH can't render it :-/ I think it's failing because the contents are too long, I'll split it up and see. Can easily remove it. |
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
@Urgau https://github.com/rust-lang/rust/blob/82684d02db0b89766a46f1efeb7f9214f690cb3c/tests/ui/suggestions/incorrect-variant-literal.svg |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
9548c77
to
729f12b
Compare
I'll move all the specific suggestion changes themselves to other PRs, but they will all clash with the diff output rendering change, so we'll have to be mindful of what lands first and then rebase properly. |
This comment has been minimized.
This comment has been minimized.
729f12b
to
68fce46
Compare
This comment was marked as resolved.
This comment was marked as resolved.
68fce46
to
9642d8c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
9642d8c
to
a9dc677
Compare
☔ The latest upstream changes (presumably #136697) made this pull request unmergeable. Please resolve the merge conflicts. |
b266cbd
to
6e995a4
Compare
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
6e995a4
to
f0845ad
Compare
@bors r=petrochenkov p=1 Raising priority to try and avoid more merge conflicts (given how many stderr files are being touched). |
@bors p=10 (conflict-prone) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (ffa9afe): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 4.6%, secondary 7.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 786.626s -> 786.457s (-0.02%) |
Apologies to all the PR authors coming to see what broke you. You just need to rebase + rebless. |
It's pretty disappointing that this PR got no discussion before it was applied. I would've definitely pushed back on the fallout of this PR had I been aware of it past it landing and changing like every UI test. :( |
…nt, r=estebank Fix presentation of purely "additive" replacement suggestion parts rust-lang#127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced. Consider: ``` LL - Self::Baz: Clone, LL + Self::Baz: Clone, T: std::clone::Clone ``` In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now. Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of rust-lang#127541. --- In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means. --- r? estebank
…nt, r=estebank Fix presentation of purely "additive" replacement suggestion parts rust-lang#127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced. Consider: ``` LL - Self::Baz: Clone, LL + Self::Baz: Clone, T: std::clone::Clone ``` In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now. Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of rust-lang#127541. --- In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means. --- r? estebank
…nt, r=estebank Fix presentation of purely "additive" replacement suggestion parts rust-lang#127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced. Consider: ``` LL - Self::Baz: Clone, LL + Self::Baz: Clone, T: std::clone::Clone ``` In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now. Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of rust-lang#127541. --- In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means. --- r? estebank
Rollup merge of rust-lang#136958 - compiler-errors:additive-replacmeent, r=estebank Fix presentation of purely "additive" replacement suggestion parts rust-lang#127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced. Consider: ``` LL - Self::Baz: Clone, LL + Self::Baz: Clone, T: std::clone::Clone ``` In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now. Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of rust-lang#127541. --- In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means. --- r? estebank
before:
r? @oli-obk