Skip to content

Strict provenance lint diagnostics improvements - #96112

Merged
bors merged 2 commits into
rust-lang:masterfrom
niluxv:strict-provenance-lint-improvements
Apr 17, 2022
Merged

Strict provenance lint diagnostics improvements#96112
bors merged 2 commits into
rust-lang:masterfrom
niluxv:strict-provenance-lint-improvements

Conversation

@niluxv

Copy link
Copy Markdown
Contributor

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

Use `multipart_suggestion` and don't suggested unnecessary parenthesis.
Use `multipart_suggestion` instead of getting a snippet.
@rustbotrustbot 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
Copy Markdown
Contributor

r? @nagisa

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

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

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

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
Member

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

@nagisanagisa 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
Copy Markdown
Member

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

@bors

bors commented Apr 16, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 1d63d6d has been approved by nagisa

@borsbors 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
@Dylan-DPCDylan-DPC mentioned this pull request Apr 16, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Apr 16, 2022
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:masterApr 17, 2022
@rustbotrustbot added this to the 1.62.0 milestone Apr 17, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@niluxv@rust-highfive@nagisa@bors@estebank@rustbot