Skip to content

Overflowing panics when debug asserts enabled or overflow checks? #108131

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

Open
albertlarsan68 opened this issue Feb 16, 2023 · 2 comments
Open

Overflowing panics when debug asserts enabled or overflow checks? #108131

albertlarsan68 opened this issue Feb 16, 2023 · 2 comments
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@albertlarsan68
Copy link
Member

albertlarsan68 commented Feb 16, 2023

Location

Methods and functions that deal with integers (non exhaustive):

Summary

The documentation in these items says clearly "If debug assertions are enabled, a panic is guaranteed".
However, the configuration can be made so that a panic doesn't occur, even though the debug assertions are enabled (through disabling the overflow checks), as shown by this godbolt, while a panic is generated when oveflow checks are enabled (godbolt).
Thus, the documentation is not accurate: while it is true that most of the time that debug assertions are enabled, the overflow checks are also enabled, this is definitly not always true.
The solution would either be to adapt the implementation to the documentation, or the other way round.

@albertlarsan68 albertlarsan68 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Feb 16, 2023
@lolbinarycat
Copy link
Contributor

I believe -Coverflow-checks was added after this documentation was written, the solution is to change "when debug assertions are enabled" to "when overflow checks are enabled".

@lolbinarycat lolbinarycat added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Mar 31, 2025
@izarma
Copy link

izarma commented Apr 6, 2025

@rustbot claim

Zalathar added a commit to Zalathar/rust that referenced this issue Apr 11, 2025
doc changes: debug assertions -> overflow checks

This PR is for the following issue:
rust-lang#108131

has some changes in docs
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 11, 2025
Rollup merge of rust-lang#139447 - izarma:issue-108131-fix, r=scottmcm

doc changes: debug assertions -> overflow checks

This PR is for the following issue:
rust-lang#108131

has some changes in docs
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 14, 2025
doc changes: debug assertions -> overflow checks

This PR is for the following issue:
rust-lang/rust#108131

has some changes in docs
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Apr 19, 2025
doc changes: debug assertions -> overflow checks

This PR is for the following issue:
rust-lang#108131

has some changes in docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants