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

some minor code simplifications #122636

Merged
merged 1 commit into from
Mar 17, 2024
Merged

some minor code simplifications #122636

merged 1 commit into from
Mar 17, 2024

Conversation

matthiaskrgr
Copy link
Member

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2024

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 17, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Mar 17, 2024
"`validation_in_progress` was already set"
);
let res = f();
assert!(
self.memory.validation_in_progress.replace(false) == true,
Copy link
Member

@RalfJung RalfJung Mar 17, 2024

Choose a reason for hiding this comment

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

I wrote these out quite deliberately, to make it much more clear what is happening: we are setting to true from false, and then back to false from true. This can be nicely expressed as assert!(val.replace(new) == old). Just because the type here is bool does not mean we should deviate from that pattern, IMO. The code becomes harder to understand with your change.

Copy link
Member Author

Choose a reason for hiding this comment

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

reverted

Copy link
Member

Choose a reason for hiding this comment

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

Is this some clippy lint or so? We should probably allow it or add a comment or so, otherwise someone else will inevitably try to do the same again.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it was needless_bool but so far I have been hesitant on sprinkling alllow attributes all over the codebase.

Copy link
Member

Choose a reason for hiding this comment

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

In this case I think it would make a lot of sense. When I wrote the code I already half-expected some clippy-driven cleanup to happen, I just didn't know how to best defend against that.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 17, 2024

📌 Commit 0437a0c has been approved by compiler-errors

It is now in the queue for this repository.

@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 Mar 17, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#120640 (Mark UEFI std support as WIP)
 - rust-lang#121862 (Add release notes for 1.77.0)
 - rust-lang#122572 (add test for rust-lang#122301 to cover behavior that's on stable)
 - rust-lang#122578 (Only invoke `decorate` if the diag can eventually be emitted)
 - rust-lang#122615 (Mention Zalathar for coverage changes)
 - rust-lang#122636 (some minor code simplifications)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1588d9b into rust-lang:master Mar 17, 2024
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2024
Rollup merge of rust-lang#122636 - matthiaskrgr:compl3, r=compiler-errors

some minor code simplifications
@rustbot rustbot added this to the 1.79.0 milestone Mar 17, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 17, 2024
…hiaskrgr

interpret/memory: explain why we use == on bool

This came up in rust-lang#122636.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 18, 2024
…hiaskrgr

interpret/memory: explain why we use == on bool

This came up in rust-lang#122636.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 18, 2024
Rollup merge of rust-lang#122654 - RalfJung:interpret-comment, r=matthiaskrgr

interpret/memory: explain why we use == on bool

This came up in rust-lang#122636.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. T-rustdoc Relevant to the rustdoc 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