Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable overflow checks in release build #1228

Closed
tzemanovic opened this issue Mar 16, 2023 · 2 comments · Fixed by #1295
Closed

Enable overflow checks in release build #1228

tzemanovic opened this issue Mar 16, 2023 · 2 comments · Fixed by #1295
Labels

Comments

@tzemanovic
Copy link
Member

The arithmetic operators have different default behavior in debug (checked, panic on overflow) vs release build (unchecked, wrapping).

We should enable overflow-checks by default in release build as it’s a safer thing to do in our settings and the added cost is worth it.

https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow

@sug0
Copy link
Collaborator

sug0 commented Apr 14, 2023

I guess this makes overflowing_* function calls mostly obsolete then, right?

@tzemanovic
Copy link
Member Author

I guess this makes overflowing_* function calls mostly obsolete then, right?

I don't think it does - it's more like combination of checked_ + unwrap. Imho it's still preferable to use explicit checked_/wrapping_/overflowing_ arithmetic over the operators, but this config at least ensures the same behavior in debug and release for when they're used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants