-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
Location
Methods and functions that deal with integers (non exhaustive):
- https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.position
- https://doc.rust-lang.org/stable/std/iter/struct.Enumerate.html#method.next
- https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.count
- https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.enumerate
- https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.sum
- https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.product
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.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.