Skip to content

interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers) #95340

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 27, 2022

Conversation

RalfJung
Copy link
Member

This is required for rust-lang/miri#2040

r? @oli-obk

@rust-highfive
Copy link
Contributor

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 26, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Mar 26, 2022

🤦 I see. Convenience methods come to bite us.

@bors r+ rolluo

@bors
Copy link
Collaborator

bors commented Mar 26, 2022

📌 Commit 3bbcf64 has been approved by oli-obk

@bors
Copy link
Collaborator

bors commented Mar 26, 2022

🌲 The tree is currently closed for pull requests below priority 100. 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 Mar 26, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Mar 26, 2022

@bors rollup

@RalfJung
Copy link
Member Author

Convenience methods come to bite us.

Yeah. I audited all uses of try_to_int; all the other methods either panic or raise an InterpError when encountering a Scalar::Ptr during CTFE so I think we'd notice if we used them wrong. Right now we actually want implicit ptr-to-int casts everywhere except for this validity check so I think we are good.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 26, 2022
interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers)

This is required for rust-lang/miri#2040

r? `@oli-obk`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 26, 2022
interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers)

This is required for rust-lang/miri#2040

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

Successful merges:

 - rust-lang#91981 (Recover suggestions and useful information lost in previous PR)
 - rust-lang#93469 (Skip pointing out ambiguous impls in alloc/std crates too in inference errors)
 - rust-lang#95335 (Move resolve_path to rustc_builtin_macros and make it private)
 - rust-lang#95340 (interpret: with enforce_number_validity, ensure integers are truly Scalar::Int (i.e., no pointers))
 - rust-lang#95341 (ARMv6K Horizon OS has_thread_local support)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 178a09e into rust-lang:master Mar 27, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 27, 2022
@RalfJung RalfJung deleted the pnvi branch March 27, 2022 13:40
saethlin added a commit to saethlin/rust that referenced this pull request Apr 9, 2022
Since rust-lang#95340 landed, Miri with
-Zmiri-check-number-validity produces an error on the test suites of
some crates which implement concurrency tools, because it seems like
such crates tend to use std::sync::mpsc in their tests. This fixes the
problem by storing pointer bytes in a pointer.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 9, 2022
…alfJung

Remove ptr-int transmute in std::sync::mpsc

Since rust-lang#95340 landed, Miri with `-Zmiri-check-number-validity` produces an error on the test suites of some crates which implement concurrency tools<sup>*</sup>, because it seems like such crates tend to use `std::sync::mpsc` in their tests. This fixes the problem by storing pointer bytes in a pointer.

<sup>*</sup> I have so far seen errors in the test suites of `once_cell`, `parking_lot`, and `crossbeam-utils`.
(just updating the list for fun, idk)
Also `threadpool`, `async-lock`, `futures-timer`, `fragile`, `scoped_threadpool`, `procfs`, `slog-async`, `scheduled-thread-pool`, `tokio-threadpool`, `mac`, `futures-cpupool`, `ntest`, `actix`, `zbus`, `jsonrpc-client-transports`, `fail`, `libp2p-gossipsub`, `parity-send-wrapper`, `async-broadcast,` `libp2p-relay`, `http-client`, `mockito`, `simple-mutex`, `surf`, `pollster`, and `pulse`. Then I turned the bot off.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2022
…fJung

Remove ptr-int transmute in std::sync::mpsc

Since rust-lang#95340 landed, Miri with `-Zmiri-check-number-validity` produces an error on the test suites of some crates which implement concurrency tools<sup>*</sup>, because it seems like such crates tend to use `std::sync::mpsc` in their tests. This fixes the problem by storing pointer bytes in a pointer.

<sup>*</sup> I have so far seen errors in the test suites of `once_cell`, `parking_lot`, and `crossbeam-utils`.
(just updating the list for fun, idk)
Also `threadpool`, `async-lock`, `futures-timer`, `fragile`, `scoped_threadpool`, `procfs`, `slog-async`, `scheduled-thread-pool`, `tokio-threadpool`, `mac`, `futures-cpupool`, `ntest`, `actix`, `zbus`, `jsonrpc-client-transports`, `fail`, `libp2p-gossipsub`, `parity-send-wrapper`, `async-broadcast,` `libp2p-relay`, `http-client`, `mockito`, `simple-mutex`, `surf`, `pollster`, and `pulse`. Then I turned the bot off.
workingjubilee pushed a commit to tcdi/postgrestd that referenced this pull request Sep 15, 2022
Since rust-lang/rust#95340 landed, Miri with
-Zmiri-check-number-validity produces an error on the test suites of
some crates which implement concurrency tools, because it seems like
such crates tend to use std::sync::mpsc in their tests. This fixes the
problem by storing pointer bytes in a pointer.
workingjubilee pushed a commit to tcdi/postgrestd that referenced this pull request Sep 15, 2022
Remove ptr-int transmute in std::sync::mpsc

Since rust-lang/rust#95340 landed, Miri with `-Zmiri-check-number-validity` produces an error on the test suites of some crates which implement concurrency tools<sup>*</sup>, because it seems like such crates tend to use `std::sync::mpsc` in their tests. This fixes the problem by storing pointer bytes in a pointer.

<sup>*</sup> I have so far seen errors in the test suites of `once_cell`, `parking_lot`, and `crossbeam-utils`.
(just updating the list for fun, idk)
Also `threadpool`, `async-lock`, `futures-timer`, `fragile`, `scoped_threadpool`, `procfs`, `slog-async`, `scheduled-thread-pool`, `tokio-threadpool`, `mac`, `futures-cpupool`, `ntest`, `actix`, `zbus`, `jsonrpc-client-transports`, `fail`, `libp2p-gossipsub`, `parity-send-wrapper`, `async-broadcast,` `libp2p-relay`, `http-client`, `mockito`, `simple-mutex`, `surf`, `pollster`, and `pulse`. Then I turned the bot off.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants