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

Strict provenance lint diagnostics improvements #96112

Merged
merged 2 commits into from
Apr 17, 2022

Conversation

niluxv
Copy link
Contributor

@niluxv niluxv commented Apr 16, 2022

Use multipart_suggestion instead of span_suggestion and getting a snippet for the expression. Also don't suggest unnecessary parenthesis in lossy_provenance_casts.
cc @estebank
@rustbot label A-diagnostics

niluxv added 2 commits April 16, 2022 10:32
Use `multipart_suggestion` and don't suggested unnecessary parenthesis.
Use `multipart_suggestion` instead of getting a snippet.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 16, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the A-diagnostics Area: Messages for errors, warnings, and lints label Apr 16, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 16, 2022
@niluxv niluxv mentioned this pull request Apr 16, 2022
];

err.multipart_suggestion(msg, suggestions, Applicability::MaybeIncorrect);
} else {
err.span_suggestion(
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why this doesn't use multipart_suggestion like in the branch above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it is not multipart? It is just a single part (single span, single suggestion String)...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does crate some inconsistency in the diagnostics depending on whether parenthesis are necessary, so maybe it would actually be better to use a multipart suggestion here too? But it just feels weird to do a multipart suggestion with only one part...

Copy link
Contributor

Choose a reason for hiding this comment

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

@niluxv If you want the suggestion to always have its own subwindow, you can use span_suggestion_verbose.

@nagisa
Copy link
Member

nagisa commented Apr 16, 2022

Looks good to me! See the question in-line.

@nagisa nagisa added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 16, 2022
@nagisa
Copy link
Member

nagisa commented Apr 16, 2022

@bors r+ Ah well, we can make that specific suggestion use multipart later, if needed.

@bors
Copy link
Contributor

bors commented Apr 16, 2022

📌 Commit 1d63d6d has been approved by nagisa

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 16, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 16, 2022
…vements, r=nagisa

Strict provenance lint diagnostics improvements

Use `multipart_suggestion` instead of `span_suggestion` and getting a snippet for the expression. Also don't suggest unnecessary parenthesis in `lossy_provenance_casts`.
cc `@estebank`
`@rustbot` label A-diagnostics
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 17, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#95346 (Stablize `const_extern_fn` for "Rust" and "C")
 - rust-lang#95933 (htmldocck: Compare HTML tree instead of plain text html)
 - rust-lang#96105 (Make the debug output for `TargetSelection` less verbose)
 - rust-lang#96112 (Strict provenance lint diagnostics improvements)
 - rust-lang#96119 (update Miri)
 - rust-lang#96124 (to_digit tweak)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 99437b3 into rust-lang:master Apr 17, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants