about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorJulian Frimmel <julian.frimmel@gmail.com>2021-10-19 07:37:25 +0200
committerJulian <julian.frimmel@gmail.com>2021-11-09 10:02:09 +0100
commit60a9d5a5a95c41702bde242705e441863d51014f (patch)
tree5d0723708d8cd072b5ca1a1da9ea4f16082efdcc /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent60952bc3da442cf2ea11dcc9c80a461a659bbcd7 (diff)
downloadrust-60a9d5a5a95c41702bde242705e441863d51014f.tar.gz
rust-60a9d5a5a95c41702bde242705e441863d51014f.zip
Re-enable `copy[_nonoverlapping]()` runtime checks
This commit re-enables the debug checks for valid usages of the two
functions `copy()` and `copy_nonoverlapping()`. Those checks were com-
mented out in #79684 in order to make the functions const. All that's
been left was a FIXME, that could not be resolved until there is was way
to only do the checks at runtime.
Since #89247 there is such a way: `const_eval_select()`. This commit
uses that new intrinsic in order to either do nothing (at compile time)
or to do the old checks (at runtime).

The change itself is rather small: in order to make the checks usable
with `const_eval_select`, they are moved into a local function (one for
`copy` and one for `copy_nonoverlapping` to keep symmetry).

The change does not break referential transparency, as there is nothing
you can do at compile time, which you cannot do on runtime without get-
ting undefined behavior. The CTFE-engine won't allow missuses. The other
way round is also fine.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions