slice::get_mut()
followed by slice::copy_from_slice
generates unreachable panic branch
#98294
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In code like the following, the compiler misses a possible optimization: in
f1
, the length ofdst
is equal to the length ofbytes
, yet the compiler generates a call tolen_mismatch_fail
.The compiler knows the lengths are equal (and thus, the panic is unreachable), because the following snippet optimizes the panic away:
This is a regression between rustc versions 1.51 and 1.52.
https://rust.godbolt.org/z/YhEY78E9P
The text was updated successfully, but these errors were encountered: