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

promotion: don't promote int::MIN / -1 #121515

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

RalfJung
Copy link
Member

Looks like I entirely forgot about this case when adding the div-by-zero check, which was supposed to ensure that we never promote operations that can fail...
Cc #80619

This is a breaking change, so needs a crater run.
r? @oli-obk

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 23, 2024
@RalfJung
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Feb 23, 2024

⌛ Trying commit 8fc2d2b with merge d378953...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 23, 2024
promotion: don't promote int::MIN / -1

Looks like I entirely forgot about this case when adding the div-by-zero check, which was supposed to ensure that we never promote operations that can fail...
Cc rust-lang#80619

This is a breaking change, so needs a crater run.
r? `@oli-obk`
@bors
Copy link
Contributor

bors commented Feb 23, 2024

☀️ Try build successful - checks-actions
Build commit: d378953 (d37895392f187de691f6c3aea0986891ff2ee255)

@RalfJung
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-121515 created and queued.
🤖 Automatically detected try build d378953
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 23, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Feb 23, 2024

why is it a breaking change? it was hard erroring in const eval before...

@RalfJung
Copy link
Member Author

Hm... I was sure this would not error, but somehow it does:

fn main() {
    if false {
        let _val = &(i32::MIN/-1);
    }
}

Are we adding promoteds to required-consts? But we can't be doing that for all promoteds because of the const-fn-call-promoted-in-const thing. Not quite sure what is happening here.

@RalfJung
Copy link
Member Author

Lol, looks like GVN triggers evaluation.

It's good that we can do that if promoteds are truly infallible, but it means we better never run GVN on const bodies until we resolved the question around const-fn-promotion...

But I guess it does indeed mean that this is not a breaking change. In fact it unbreaks the case above where the division is in dead code.

@craterbot abort
@rustbot ready

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 23, 2024
@craterbot
Copy link
Collaborator

🗑️ Experiment pr-121515 deleted!

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot removed the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Feb 23, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Feb 23, 2024

Yea I'd expect the other direction to be a breaking change. Even without GVN I'd assume we eval these promoteds at some point 😅

@oli-obk
Copy link
Contributor

oli-obk commented Feb 24, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 24, 2024

📌 Commit f32095c has been approved by oli-obk

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 24, 2024

🌲 The tree is currently closed for pull requests below priority 50. 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 Feb 24, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 24, 2024
…-obk

promotion: don't promote int::MIN / -1

Looks like I entirely forgot about this case when adding the div-by-zero check, which was supposed to ensure that we never promote operations that can fail...
Cc rust-lang#80619

This is a breaking change, so needs a crater run.
r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 24, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121343 (Add examples for some methods on slices)
 - rust-lang#121374 (match lowering: Split off `test_candidates` into several functions and improve comments)
 - rust-lang#121474 (Ignore compiletest test directive migration commits)
 - rust-lang#121515 (promotion: don't promote int::MIN / -1)
 - rust-lang#121530 (Fix incorrect doc of ScopedJoinHandle::is_finished)
 - rust-lang#121551 (Forbid use of `extern "C-unwind"` inside standard library)
 - rust-lang#121556 (Use `addr_of!`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a189c89 into rust-lang:master Feb 25, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 25, 2024
Rollup merge of rust-lang#121515 - RalfJung:fallible-promotion, r=oli-obk

promotion: don't promote int::MIN / -1

Looks like I entirely forgot about this case when adding the div-by-zero check, which was supposed to ensure that we never promote operations that can fail...
Cc rust-lang#80619

This is a breaking change, so needs a crater run.
r? ``@oli-obk``
@RalfJung RalfJung deleted the fallible-promotion branch February 25, 2024 07:14
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.

5 participants