Skip to content
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

Improve structured tuple struct suggestion #88631

Merged
merged 2 commits into from
Sep 6, 2021
Merged

Conversation

camelid
Copy link
Member

@camelid camelid commented Sep 4, 2021

Previously, the span was just for the constructor name, which meant it
would result in syntactically-invalid code when applied. Now, the span
is for the entire expression.

I also changed it to use span_suggestion_verbose, for two reasons:

  1. Now that the suggestion span has been corrected, the output is a bit
    cluttered and hard to read. Putting the suggestion its own window
    creates more space.

  2. It's easier to see what's being suggested, since now the version
    after the suggestion is applied is shown.

r? @davidtwco

(And same for tuple variants.)

Previously, the span was just for the constructor name, which meant it
would result in syntactically-invalid code when applied. Now, the span
is for the entire expression.
For two reasons:

1. Now that the suggestion span has been corrected, the output is a bit
   cluttered and hard to read. Putting the suggestion its own window
   creates more space.

2. It's easier to see what's being suggested, since now the version
   after the suggestion is applied is shown.
@camelid camelid added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. labels Sep 4, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 4, 2021
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 6, 2021

📌 Commit 2226977 has been approved by davidtwco

@bors 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 Sep 6, 2021
@bors
Copy link
Contributor

bors commented Sep 6, 2021

⌛ Testing commit 2226977 with merge d19d864...

@bors
Copy link
Contributor

bors commented Sep 6, 2021

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing d19d864 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 6, 2021
@bors bors merged commit d19d864 into rust-lang:master Sep 6, 2021
@rustbot rustbot added this to the 1.57.0 milestone Sep 6, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d19d864): comparison url.

Summary: This change led to small relevant mixed results 🤷 in compiler performance.

  • Very small improvement in instruction counts (up to -1.1% on incr-patched: add static arr item builds of coercions)
  • Small regression in instruction counts (up to 0.3% on incr-full builds of clap-rs)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions (either in this PR if it's not yet merged or in another PR), and then add the perf-regression-triaged label to this PR.

@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 6, 2021
@rylev
Copy link
Member

rylev commented Sep 6, 2021

The waiting on review label was added accidentally, since we're now posting perf results after merges happen. I'll remove the label.

@rustbot label: -S-waiting-on-review

The summary that this PR led to a mixed performance change seems correct though the change is quite small. We might want to tweak the perf bot to not post in such cases.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 6, 2021
@camelid camelid deleted the sugg-span branch September 6, 2021 16:56
@camelid
Copy link
Member Author

camelid commented Sep 6, 2021

The perf results still seem much worse than I would have thought. The only non-error path change is that an extra Span is passed as a function argument. I wonder if these results are somewhat spurious. For example, clap-rs-opt regressed by ~0.3%, while clap-rs-debug was unchanged—but this change isn't in the optimizer, so it shouldn't have an effect on one but not the other.

@rylev Should this be marked as perf-regression-triaged then?

@rylev
Copy link
Member

rylev commented Sep 7, 2021

Yep - it looks spurious - all the perf changes except 2 are considered "very small" by our standards with the other two barely registering as "small" changes. Given that there doesn't seem to be a plausible explanation, and the perf change is mostly a wash, we should marked this as triaged.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants