]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #99223 - saethlin:panicless-split-mut, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Mon, 18 Jul 2022 10:16:58 +0000 (10:16 +0000)
committerbors <bors@rust-lang.org>
Mon, 18 Jul 2022 10:16:58 +0000 (10:16 +0000)
commit9ed0bf9f2bd63933785fb8a380c177d2d70e88ec
treebfb57073698c842ec8dcf94a021e2b3c77f59afd
parent880416180b0a9ee1141c07d4d17667edb77daebd
parentc9373903e759c96f2ab8ba2a78c6799b5d92b105
Auto merge of #99223 - saethlin:panicless-split-mut, r=Mark-Simulacrum

Rearrange slice::split_mut to remove bounds check

Closes https://github.com/rust-lang/rust/issues/86313

Turns out that all we need to do here is reorder the bounds checks to convince LLVM that all the bounds checks can be removed. It seems like LLVM just fails to propagate the original length information past the first bounds check and into the second one. With this implementation it doesn't need to, each check can be proven inbounds based on the one immediately previous.

I've gradually convinced myself that this implementation is unambiguously better based on the above logic, but maybe this is still deserving of a codegen test?

Also the mentioned borrowck limitation no longer seems to exist.