Skip to content

Commit

Permalink
Auto merge of #131572 - cuviper:ub-index_range, r=thomcc
Browse files Browse the repository at this point in the history
Avoid superfluous UB checks in `IndexRange`

`IndexRange::len` is justified as an overall invariant, and
`take_prefix` and `take_suffix` are justified by local branch
conditions. A few more UB-checked calls remain in cases that are only
supported locally by `debug_assert!`, which won't do anything in
distributed builds, so those UB checks may still be useful.

We generally expect core's `#![rustc_preserve_ub_checks]` to optimize
away in user's release builds, but the mere presence of that extra code
can sometimes inhibit optimization, as seen in #131563.
  • Loading branch information
bors committed Oct 17, 2024
2 parents 46fcc29 + ec6a41b commit cfe7f2a
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit cfe7f2a

Please sign in to comment.