rust/library/core/src/ops
Dylan DPC 83faac9da4
Rollup merge of #82683 - jturner314:int-div-rem-doc-panic, r=nikomatsakis
Document panicking cases for integer division and remainder

This PR documents the cases when integer division and remainder operations panic. These operations panic in two cases: division by zero and overflow.

It's surprising that these operations always panic on overflow, unlike most other arithmetic operations, which panic on overflow only when `debug_assertions` is enabled. The panic on overflow for the remainder is also surprising because a return value of `0` would be reasonable in this case. ("Overflow" occurs only for `MIN % -1`.) Since the panics on overflow are somewhat surprising, they should be documented.

I guess it's worth asking: is panic on overflow (even when `debug_assertions` is disabled) the intended behavior? If not, what's the best way forward?
2021-03-22 15:21:24 +01:00
..
arith.rs Document panicking cases for integer remainder 2021-03-01 17:13:50 -05:00
bit.rs documentation examples fixes in rustfmt convention 2020-11-01 18:53:22 +05:30
control_flow.rs Expand the docs for ops::ControlFlow a bit 2021-02-06 22:36:05 -08:00
deref.rs Fix borrow and deref 2021-03-03 11:23:29 +01:00
drop.rs Remove links that get imported from the prelude 2020-08-21 23:27:23 +02:00
function.rs Convert primitives to use intra-doc links 2021-02-25 20:31:53 -05:00
generator.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
index.rs More consistently use spaces after commas in lists in docs 2020-11-21 14:43:34 -05:00
mod.rs Use Self more in core in doc when possible 2020-09-23 00:16:16 +02:00
range.rs Rename Range::ensure_subset_of to slice::range 2021-02-12 22:01:04 -05:00
try.rs apply bootstrap cfgs 2020-08-26 10:17:31 +02:00
unsize.rs Use intra-doc-links in core::ops::* 2020-08-21 23:19:10 +02:00