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 8c0736a + 3d4c1a3 commit 849be35
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 849be35

Please sign in to comment.