Bounds check are added for array when they should not (most likely) #103528
Labels
C-bug
Category: This is a bug.
regression-untriaged
Untriaged performance or correctness regression.
Code
I tried this code:
and checked the generated code for Rust 1.64 and 1.63, see here.
I expected the compiler to omit the bounds check on the array since the values of the enum are known and it's not possible to have a value outside of the allowed range of indices (unless you use
transmute
but that would be unsafe).This is generated as expected for Rust 1.63.0 but the bounds check is added for Rust 1.64.0.
Is this expected behaviour?
Version it worked on
It most recently worked on: 1.63.0
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: