How do I allow add overflow for certain lines

I'm writing some codes which highly rely on the add overflow feature, but these codes cannot pass the test since rustc will check the overflow for debug version.

The checking is good, I don't want to disable it, but just not for certain lines.

Can this be done?

If your code relies on overflow occurring, use wrapping_add, or the Wrapping type.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.