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 memory ordering diagnostics #97389

Merged
merged 4 commits into from
Jun 27, 2022

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented May 25, 2022

Before:

image

After:

image


Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct.

Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.

@m-ou-se m-ou-se added A-diagnostics Area: Messages for errors, warnings, and lints A-concurrency Area: Concurrency T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. labels May 25, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 25, 2022
@m-ou-se m-ou-se changed the title Memory ordering diagnostics Improve memory ordering diagnostics May 25, 2022
@nagisa
Copy link
Member

nagisa commented May 26, 2022

This is quite awesome and is something I encountered recently as well! Unfortunately don't have capacity to review rustc PRs right now.

r? @estebank

@rust-highfive rust-highfive assigned estebank and unassigned nagisa May 26, 2022
Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

Left a couple of nitpicks, but otherwise LGTM.

compiler/rustc_lint/src/types.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/types.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/types.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/types.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/types.rs Outdated Show resolved Hide resolved
@m-ou-se m-ou-se force-pushed the memory-ordering-diagnostics branch from 82b8e39 to f107923 Compare June 22, 2022 18:09
@m-ou-se
Copy link
Member Author

m-ou-se commented Jun 22, 2022

Applied your suggestions.

@bors r=estebank

Not sure how long this will stay relevant though. If #98383 gets merged, most of this lint can disappear. ^^'

@bors
Copy link
Contributor

bors commented Jun 22, 2022

📌 Commit f107923 has been approved by estebank

@bors
Copy link
Contributor

bors commented Jun 22, 2022

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@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 Jun 22, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 27, 2022
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#97389 (Improve memory ordering diagnostics)
 - rust-lang#97780 (Check ADT field is well-formed before checking it is sized)
 - rust-lang#98530 (compiletest: add issue number param to `known-bug`)
 - rust-lang#98556 (Fix builds on Windows (closes rust-lang#98546))
 - rust-lang#98561 (Fix spelling in SAFETY comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3694e40 into rust-lang:master Jun 27, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jun 27, 2022
@m-ou-se m-ou-se deleted the memory-ordering-diagnostics branch June 27, 2022 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-concurrency Area: Concurrency A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` D-papercut Diagnostics: An error or lint that needs small tweaks. 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.

7 participants