]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Tue, 30 Aug 2022 05:56:51 +0000 (11:26 +0530)
committerGitHub <noreply@github.com>
Tue, 30 Aug 2022 05:56:51 +0000 (11:26 +0530)
commit81f3841cfb5eae52d7914dfebb6a55b5951c5c3c
tree8f53022e4f14533603ae07b48c3d9b0ce2eaf6c7
parent1ea84961e81de8e0eebbb8353d7867a039ffa70f
parentc46e803aaf5a0bfc5dfcd1570349eee71ce81634
Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk

interpret: make read-pointer-as-bytes a CTFE-only error with extra information

Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456.

Pointer-to-int transmutation during CTFE now produces a message like this:
```
   = help: this code performed an operation that depends on the underlying bytes representing a pointer
   = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
```

r? ``@oli-obk``
12 files changed:
compiler/rustc_codegen_cranelift/src/constant.rs
compiler/rustc_const_eval/src/const_eval/error.rs
compiler/rustc_const_eval/src/const_eval/eval_queries.rs
compiler/rustc_const_eval/src/interpret/machine.rs
compiler/rustc_const_eval/src/interpret/operand.rs
compiler/rustc_const_eval/src/interpret/place.rs
compiler/rustc_const_eval/src/interpret/projection.rs
compiler/rustc_const_eval/src/interpret/validity.rs
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/pretty.rs
compiler/rustc_middle/src/ty/print/pretty.rs
src/test/ui/consts/miri_unleashed/ptr_arith.stderr