about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-02-13 04:36:56 +0100
committerGitHub <noreply@github.com>2019-02-13 04:36:56 +0100
commit0ed894afaee1c96d046a00ecbd6b3fd4a6841caf (patch)
tree706731506c57c727d601d175d2668ccd339622a9 /src/rustllvm/RustWrapper.cpp
parent734cc3e79ed2a599482a41ae5edd88338603d954 (diff)
parent5a7cd848f740291f94f2400b50f41136fc8657bb (diff)
downloadrust-0ed894afaee1c96d046a00ecbd6b3fd4a6841caf.tar.gz
rust-0ed894afaee1c96d046a00ecbd6b3fd4a6841caf.zip
Rollup merge of #57815 - dotdash:asserts, r=sfackler
Speed up the fast path for assert_eq! and assert_ne!

Currently, the panic!() calls directly borrow the value bindings. This
causes those bindings to always be initialized, i.e. they're initialized
even before the values are even compared. This causes noticeable
overhead in what should be a really cheap operation.

By performing a reborrow of the value in the call to panic!(), we allow
LLVM to optimize that code, so that the extra borrow only happens in the
error case.

We could achieve the same result by dereferencing the values passed to
panic!(), as the format machinery borrows them anyway, but this causes
assertions to fail to compile if one of the values is unsized, i.e. it
would be a breaking change.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions