Skip to content

Commit

Permalink
Auto merge of #121571 - clarfonthey:unchecked-math-preconditions, r=s…
Browse files Browse the repository at this point in the history
…aethlin

Add assert_unsafe_precondition to unchecked_{add,sub,neg,mul,shl,shr} methods

(Old PR is haunted, opening a new one. See #117494 for previous discussion.)

This ensures that these preconditions are actually checked in debug mode, and hopefully should let people know if they messed up. I've also replaced the calls (I could find) in the code that use these intrinsics directly with those that use these methods, so that the asserts actually apply.

More discussions on people misusing these methods in the tracking issue: rust-lang/rust#85122.
  • Loading branch information
bors committed May 25, 2024
2 parents 2d57cf5 + 7056b6a commit 33b4e9f
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 33b4e9f

Please sign in to comment.