]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obk
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Fri, 11 Mar 2022 19:29:45 +0000 (20:29 +0100)
committerGitHub <noreply@github.com>
Fri, 11 Mar 2022 19:29:45 +0000 (20:29 +0100)
CTFE/Miri: detect out-of-bounds pointers in offset_from

Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now.

Hiding whitespaces helps with the diff.

Fixes https://github.com/rust-lang/miri/issues/1950

r? ``@oli-obk``

1  2 
compiler/rustc_const_eval/src/interpret/memory.rs