Skip to content

[arithmetic_side_effects] Fix #10252#10309

Merged
bors merged 1 commit into
rust-lang:masterfrom
c410-f3r:arith
Mar 9, 2023
Merged

[arithmetic_side_effects] Fix #10252#10309
bors merged 1 commit into
rust-lang:masterfrom
c410-f3r:arith

Conversation

@c410-f3r

@c410-f3r c410-f3r commented Feb 9, 2023

Copy link
Copy Markdown
Contributor

Fix #10252

At least for integers, shifts are already handled by the compiler.


changelog: [arithmetic_side_effects]: No longer lints on right or left shifts with constant integers, as the compiler warns about them.
#10309

@rustbot

rustbot commented Feb 9, 2023

Copy link
Copy Markdown
Collaborator

r? @giraffate

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 9, 2023
@xFrednet

Copy link
Copy Markdown
Contributor

Hey @c410-f3r regarding the changelog entry, would you mind telling me what CTFT stands for?

Based on the linked issue, I understand that this change allows shifts, if they're verifiably inside the bounds of the shifted integer. Is that correct?

@c410-f3r

Copy link
Copy Markdown
Contributor Author

Hey @c410-f3r regarding the changelog entry, would you mind telling me what CTFT stands for?

CTFE -> Constant Time Function Evaluator

Based on the linked issue, I understand that this change allows shifts, if they're verifiably inside the bounds of the shifted integer. Is that correct?

Yes, Rustc is smart enough to handle out-of-bounds shifts for known integers.

Actually, the term CTFE is being abused and I am not totally sure if this specific part is indeed handled by the CTFE. It is probably best to just say compiler or Rustc instead.

@bors

bors commented Feb 12, 2023

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #10310) made this pull request unmergeable. Please resolve the merge conflicts.

@xFrednet

Copy link
Copy Markdown
Contributor

Thank you for the explanation! :)

@c410-f3r

Copy link
Copy Markdown
Contributor Author

ping @giraffate

@giraffate

Copy link
Copy Markdown
Contributor

I'll review this in a few days.

@giraffate

Copy link
Copy Markdown
Contributor

@bors r+

Thanks!

@bors

bors commented Mar 9, 2023

Copy link
Copy Markdown
Contributor

📌 Commit c439373 has been approved by giraffate

It is now in the queue for this repository.

@bors

bors commented Mar 9, 2023

Copy link
Copy Markdown
Contributor

⌛ Testing commit c439373 with merge ea4ebed...

@bors

bors commented Mar 9, 2023

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing ea4ebed to master...

@bors bors merged commit ea4ebed into rust-lang:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[arithmetic_side_effects] Shifts by in-bounds literals trigger a false positive.

5 participants