Summary
int_plus_one can produce inefficient code because the - 1 is used for bounds checking optimizations. The way to address this is issue unclear, but this should at least be mentioned in documentation.
Reproducer
In short: https://godbolt.org/z/fabdj4TsE
Related issue: #9268
Version
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: x86_64-unknown-linux-gnu
release: 1.85.0
LLVM version: 19.1.7
Additional Labels
No response
Summary
int_plus_onecan produce inefficient code because the- 1is used for bounds checking optimizations. The way to address this is issue unclear, but this should at least be mentioned in documentation.Reproducer
In short: https://godbolt.org/z/fabdj4TsE
Related issue: #9268
Version
Additional Labels
No response