Skip to content

interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch#117832

Merged
bors merged 1 commit into
rust-lang:masterfrom
RalfJung:interpret-shift
Nov 20, 2023
Merged

interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch#117832
bors merged 1 commit into
rust-lang:masterfrom
RalfJung:interpret-shift

Conversation

@RalfJung

Copy link
Copy Markdown
Member

While we're at it, also update comments in codegen and MIR building related to shifts, and fix the overflow error printed by Miri on negative shift amounts.

@rustbot

rustbot commented Nov 12, 2023

Copy link
Copy Markdown
Collaborator

r? @cjgillot

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

@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 Nov 12, 2023
@rustbot

rustbot commented Nov 12, 2023

Copy link
Copy Markdown
Collaborator

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

// For a signed RHS, `IntToInt` cast to the equivalent unsigned
// type and do that same comparison. Because the type is the
// same size, there's no negative shift amount that ends up
// overlapping with valid ones, thus it catches negatives too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@scottmcm you wrote in b537e6b "because the type is the same size, there's no negative shift amount that ends up overlapping with valid ones". I don't understand that argument. What does "we're casting from signed to unsigned with the same size" have to do with the second half of the sentence?

I have replaced this comment with an argument that I do understand.

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.

I don't remember what I meant by "same size", since mixed-width shifts are allowed for MIR.

What you have now -- that iN::MIN as uN will never conflict with a legal shift -- is really what I was trying to express, I think.

@rust-log-analyzer

This comment has been minimized.

…signed and unsigned shift amounts in the same branch
@cjgillot

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Nov 19, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 31493c7 has been approved by cjgillot

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 Nov 19, 2023
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Nov 20, 2023
interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch

While we're at it, also update comments in codegen and MIR building related to shifts, and fix the overflow error printed by Miri on negative shift amounts.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#115526 (Add arm64e-apple-ios & arm64e-apple-darwin targets)
 - rust-lang#115691 (Add `$message_type` field to distinguish json diagnostic outputs)
 - rust-lang#117828 (Avoid iterating over hashmaps in astconv)
 - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch)
 - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`)
 - rust-lang#117957 (if available use a Child's pidfd for kill/wait)
 - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence)
 - rust-lang#118068 (subtree update cg_gcc 2023/11/17)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#115526 (Add arm64e-apple-ios & arm64e-apple-darwin targets)
 - rust-lang#115691 (Add `$message_type` field to distinguish json diagnostic outputs)
 - rust-lang#117828 (Avoid iterating over hashmaps in astconv)
 - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch)
 - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`)
 - rust-lang#117957 (if available use a Child's pidfd for kill/wait)
 - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence)
 - rust-lang#118068 (subtree update cg_gcc 2023/11/17)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#117828 (Avoid iterating over hashmaps in astconv)
 - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch)
 - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`)
 - rust-lang#117957 (if available use a Child's pidfd for kill/wait)
 - rust-lang#117988 (Handle attempts to have multiple `cfg`d tail expressions)
 - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence)
 - rust-lang#118000 (Make regionck care about placeholders in outlives components)
 - rust-lang#118068 (subtree update cg_gcc 2023/11/17)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
…tthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#117828 (Avoid iterating over hashmaps in astconv)
 - rust-lang#117832 (interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch)
 - rust-lang#117891 (Recover `dyn` and `impl` after `for<...>`)
 - rust-lang#117957 (if available use a Child's pidfd for kill/wait)
 - rust-lang#117988 (Handle attempts to have multiple `cfg`d tail expressions)
 - rust-lang#117994 (Ignore but do not assume region obligations from unifying headers in negative coherence)
 - rust-lang#118000 (Make regionck care about placeholders in outlives components)
 - rust-lang#118068 (subtree update cg_gcc 2023/11/17)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 94d9b7e into rust-lang:master Nov 20, 2023
@rustbot rustbot added this to the 1.76.0 milestone Nov 20, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 20, 2023
Rollup merge of rust-lang#117832 - RalfJung:interpret-shift, r=cjgillot

interpret: simplify handling of shifts by no longer trying to handle signed and unsigned shift amounts in the same branch

While we're at it, also update comments in codegen and MIR building related to shifts, and fix the overflow error printed by Miri on negative shift amounts.
@bors

bors commented Nov 20, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 31493c7 with merge 46ecc10...

@Noratrieb

Copy link
Copy Markdown
Member

https://bors.rust-lang.org/queue/rust according to the queue, this is currently being bored...
@bors r- wtf are you doing

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 20, 2023
@Noratrieb

Copy link
Copy Markdown
Member

Screenshot_20231120-182602

@RalfJung RalfJung deleted the interpret-shift branch November 20, 2023 17:30
@RalfJung

Copy link
Copy Markdown
Member Author

@bors force

@dtolnay

dtolnay commented Nov 20, 2023

Copy link
Copy Markdown
Member

5 hours later, still running in queue and blocking other PRs from being tested.

I believe this interrupts a currently running build:

@bors retry

@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 Nov 20, 2023
@dtolnay

dtolnay commented Nov 20, 2023

Copy link
Copy Markdown
Member

That worked — this PR is no longer "pending" at the top of the queue.

But no other PR has immediately started being tested, as far as I can tell, which is a bad sign.

@dtolnay

dtolnay commented Nov 20, 2023

Copy link
Copy Markdown
Member

Okay it just took 6 minutes after "bors retry", but #118093 (comment) is testing now. Everything looks back to normal.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants