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

Make lit_to_mir_constant and lit_to_const infallible #135195

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 7, 2025

My motivation for this change is just that it's annoying to check everywhere, especially since all but one call site was just ICEing on errors anyway right there.

They can still fail, but now just return an error constant instead of having the caller handle the error.

fixes #114317
fixes #126182

@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
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 Jan 7, 2025
@oli-obk oli-obk changed the title Make lit_to_mir_constant infallible Make lit_to_mir_constant and lit_to_const infallible Jan 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2025

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

Some changes occurred in match checking

cc @Nadrieril

HIR ty lowering was modified

cc @fmease

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the push-toyoyrupruko branch from 2256627 to f6146ff Compare January 7, 2025 16:00
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the push-toyoyrupruko branch from f6146ff to eb63fd6 Compare January 8, 2025 08:44
@rust-log-analyzer

This comment has been minimized.

trunc(if neg { (n.get() as i128).overflowing_neg().0 as u128 } else { n.get() })
}
(ast::LitKind::Float(n, _), ty::Float(fty)) => {
parse_float_into_constval(*n, *fty, neg).unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

delayed_bug to bug, it's unreachable I guess? 😁 though given we've got no tests for that, I don't mind merging this and reacting to a fuzzer ICE if it's reachable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, I looked into this before the holidays and if memory serves right the parser ensures we don't get anything that could fail here.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

gamer

r=me after nits

@lcnr lcnr assigned lcnr and unassigned fee1-dead Jan 8, 2025
@oli-obk oli-obk force-pushed the push-toyoyrupruko branch from eb63fd6 to 5d0405d Compare January 8, 2025 12:41
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the push-toyoyrupruko branch from 5d0405d to c92ed62 Compare January 8, 2025 13:49
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 8, 2025

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 8, 2025

📌 Commit c92ed62 has been approved by lcnr

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 Jan 8, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#134228 (Exhaustively handle expressions in patterns)
 - rust-lang#135194 (triagebot: mark tidy changes with a more specific `A-tidy` label)
 - rust-lang#135222 (Ensure that we don't try to access fields on a non-struct pattern type)
 - rust-lang#135250 (A couple simple borrowck cleanups)
 - rust-lang#135252 (Fix release notes link)
 - rust-lang#135253 (Revert rust-lang#131365)

Failed merges:

 - rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2025
Make `lit_to_mir_constant` and `lit_to_const` infallible

My motivation for this change is just that it's annoying to check everywhere, especially since all but one call site was just ICEing on errors anyway right there.

They can still fail, but now just return an error constant instead of having the caller handle the error.

fixes rust-lang#114317
fixes rust-lang#126182
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#134228 (Exhaustively handle expressions in patterns)
 - rust-lang#135194 (triagebot: mark tidy changes with a more specific `A-tidy` label)
 - rust-lang#135222 (Ensure that we don't try to access fields on a non-struct pattern type)
 - rust-lang#135250 (A couple simple borrowck cleanups)
 - rust-lang#135252 (Fix release notes link)
 - rust-lang#135253 (Revert rust-lang#131365)

Failed merges:

 - rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#128110 (Suggest Replacing Comma with Semicolon in Incorrect Repeat Expressions)
 - rust-lang#134609 (Add new `{x86_64,i686}-win7-windows-gnu` targets)
 - rust-lang#134875 (Implement `const Destruct` in old solver)
 - rust-lang#135221 (Include rustc and rustdoc book in replace-version-placeholder)
 - rust-lang#135231 (bootstrap: Add more comments to some of the test steps)
 - rust-lang#135256 (Move `mod cargo`  below the import statements)

Failed merges:

 - rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

@bors r-
needs rebase

@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 Jan 9, 2025
@oli-obk oli-obk force-pushed the push-toyoyrupruko branch from c92ed62 to 84c8d4f Compare January 9, 2025 08:49
@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 9, 2025

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jan 9, 2025

📌 Commit 84c8d4f has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 9, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
…iaskrgr

Rollup of 3 pull requests

Successful merges:

 - rust-lang#134898 (Make it easier to run CI jobs locally)
 - rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)
 - rust-lang#135261 (Account for identity substituted items in symbol mangling)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
…iaskrgr

Rollup of 3 pull requests

Successful merges:

 - rust-lang#134898 (Make it easier to run CI jobs locally)
 - rust-lang#135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible)
 - rust-lang#135261 (Account for identity substituted items in symbol mangling)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8ff355a into rust-lang:master Jan 9, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 9, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2025
Rollup merge of rust-lang#135195 - oli-obk:push-toyoyrupruko, r=lcnr

Make `lit_to_mir_constant` and `lit_to_const` infallible

My motivation for this change is just that it's annoying to check everywhere, especially since all but one call site was just ICEing on errors anyway right there.

They can still fail, but now just return an error constant instead of having the caller handle the error.

fixes rust-lang#114317
fixes rust-lang#126182
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
8 participants