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

interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal #95785

Merged
merged 1 commit into from
Apr 9, 2022

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Apr 7, 2022

We did this a while ago already for to_i32() and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by read_pointer in a Miri shim where the code was passing an argument at the wrong type.

Having scalar_to_ptr be fallible is consistent with all the other Scalar::to_* methods being fallible. I added unwrap only in code outside the interpreter, which is no worse off than before now in terms of panics.

r? @oli-obk

@rust-highfive
Copy link
Collaborator

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 7, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 7, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Apr 7, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 7, 2022

📌 Commit 38004b7 has been approved by oli-obk

@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 Apr 7, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 7, 2022
…=oli-obk

interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal

We did this a while ago already for `to_i32()` and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by `read_pointer` in a Miri shim where the code was passing an argument at the wrong type.

Having `scalar_to_ptr` be fallible is consistent with all the other `Scalar::to_*` methods being fallible. I added `unwrap` only in code outside the interpreter, which is no worse off than before now in terms of panics.

r? `@oli-obk`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 8, 2022
…=oli-obk

interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal

We did this a while ago already for `to_i32()` and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by `read_pointer` in a Miri shim where the code was passing an argument at the wrong type.

Having `scalar_to_ptr` be fallible is consistent with all the other `Scalar::to_*` methods being fallible. I added `unwrap` only in code outside the interpreter, which is no worse off than before now in terms of panics.

r? ``@oli-obk``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 9, 2022
…=oli-obk

interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal

We did this a while ago already for `to_i32()` and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by `read_pointer` in a Miri shim where the code was passing an argument at the wrong type.

Having `scalar_to_ptr` be fallible is consistent with all the other `Scalar::to_*` methods being fallible. I added `unwrap` only in code outside the interpreter, which is no worse off than before now in terms of panics.

r? ```@oli-obk```
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 9, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#95308 (Reduce the amount of unstable features used in libproc_macro)
 - rust-lang#95676 (Update RLS)
 - rust-lang#95769 (Hide cross-crate `#[doc(hidden)]` associated items in trait impls)
 - rust-lang#95785 (interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal)
 - rust-lang#95802 (fix unused constant warning on some Windows targets)
 - rust-lang#95810 (Use `format-args-capture` and remove unnecessary nested blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dfb4194 into rust-lang:master Apr 9, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 9, 2022
@RalfJung RalfJung deleted the interpret-size-mismatch branch April 11, 2022 02:57
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